Bitnami Wordpress File System 100% on Lightsail

0

How can I get permission to access /opt/bitnami/mysql/data to remove old .gz log files to free up some space? In the past when the file system filled up, I had permissions to remove the files using the find command like this. sudo find /opt/bitnami/mysql/data//mysqld.log-.gz -type file -exec rm {} ; I am logged in as bitnami user. The directory has use and group permission as follows: mysql root.

The mysql database filled up the filesystem and has stopped and can't be started until space is freed up. I researched the reason that the database filled up and found that it was due to wp_options table becoming to large. If I can reclaim some space I would be able to restart the database and run the following commands to reduce the size of the wp_options table.

sudo /opt/bitnami/mysql/bin/mysqlcheck -c bitnami_wordpress wp_options -u bn_wordpress -p sudo /opt/bitnami/mysql/bin/mysqlcheck -o bitnami_wordpress wp_options -u bn_wordpress -p sudo /opt/bitnami/mysql/bin/mysqlcheck -a bitnami_wordpress wp_options -u bn_wordpress -p

asked 9 months ago424 views
2 Answers
0

Hello.
Looking at the delete command, it appears to be using the root user with "sudo".
Are you saying that you can't delete the root user even if you are using the root user?

sudo su -
sudo find /opt/bitnami/mysql/data//mysqld.log-.gz -type file -exec rm {} ;
profile picture
EXPERT
answered 9 months ago
  • I was trying to delete the old gziped log files in the data directory. I was able to chmod and fix the issue, however yesterday it didn't seem to work.

0

The syntax of your find command is incorrect, the path you are searching needs to be separate to the filename.

What's the directory your SQL log files are in (that you want to delete)? From the above my best guess is that it's something like /opt/bitnami/mysql/data/, yes?

And what's the naming format of the files you want to delete? From the command above it looks like you're looking for a file called precisely mysqld.log-.gz which sounds unlikely.

My guess is that your logs are called something like mysqld.log-1.gz, mysqld.log-2.gz, and so on, is that right?

If so then you need a ? as a wildcard in your find command, something like:

sudo find /opt/bitnami/mysql/data/ -name mysqld.log-?.gz -type f

If the output from this is a list of the files you want to delete then run it again, with -exec rm {} ;\ appended to it.

Alternately, if your logs are called something like mysqld.log-20230808.gz, mysqld.log-20230801.gz, and so on, in that case replace your single question-mark wildcard with an asterisk, and then run:

sudo find /opt/bitnami/mysql/data/ -name mysqld.log-*.gz -type f

Check it comes back with the files that you want to delete. All good? Then run it again, with -exec rm {} ;\ appended to it.

profile picture
EXPERT
Steve_M
answered 9 months ago
  • Thanks for your input. The issue at hand was the permissions issue that did not allow me to delete the old log files in the /opt/bitnami/mysql/data directory. I have since resolved that issue and deleted the old files, gained back 20% available space in the / directory. That was enough to start the mysql database and recreate the wp_options table which was filling up the file system.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions