Yesterday our /var got completely full. One reason I believe is there was
a huge data table and a cronjob to make a backup of the huge data table
(so there were two). To clear it, someone removed the files in /var/lib/mysql
instead of deleting from table which I think would have been better. Anyway
no matter how much we removed from /var it remained 100% full. Even though
a du -s on the entrie system showed less than 1 gig, a df showed /var
capacity of 20G completely full so we figure the OS did not reclaim space
after deleting that way so we did a reboot.
Anyway someone noticed on this machine, /var is its own partition of 20G
(and mysql runs under /var/lib). They wanted us to add more space to /var
which I had no idea how to do.
But then I wondered, isn't it all controlled by /etc/my.cnf? We have a
/home of like 418G of which 380G is still available. Couldn't I do
something like this?
mkdir -p /home/data/lib/mysql # Make a new location
mysqldump --all-databases > /home/saveme.sql
service mysqld stop
Then edit /etc/my.cnf and change
datadir to /home/data/lib/mysql
socket to /home/data/lib/mysql/mysql.sock
err-log and pid-file are ok as they are I assume, and for some reason
we commented basedir=
chown -R mysql:mysql /home/data
service mysqld start # start it again
mysql < /home/saveme.sql # restore database
and then it would be running on the new partition? Or did I miss
By the way:
mysql Ver 14.12 Distrib[masked], for pc-linux-gnu (i686) using readline 5.0
we also sometimes use[masked]
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).