Move MySQL datadir to new partition

I had to move a mysql datadir to a new partition as it was stored in /var/lib/mysql but df -h showed the main partition being /data and the / partition was now full up. This was a Centos machine.

I stopped mysql –

/etc/init.d/mysqld stop

I copied the mysql databases over to the new directory I created –

mkdir /data/mysql && cp -R /var/lib/mysql/* /data/mysql/

Changed the owndership –

chown -R mysql:mysql /data/mysql

I ensured the permissions were set properly and matched on both old and new directories by checking them with ls -l on the folder and inside them. They are usually 700 I believe on mysql.


I then edited the startup script –

vi /etc/init.d/mysqld

I changed the datadir line to the new directory.

I then changed the /etc/my.cnf file to use the new directory (it was hard set here too, so you should check that).

I tried starting mysql and checking it was using the new datadir –

/etc/init.d/mysqld start

ps ax | grep sql

I then stopped mysql and removed the old databases in /var/lib/mysql (to free up the space)

I started mysql again – /etc/init.d/mysql but when looking at the logs I saw it was crashed, so I ran mysqlcheck -A (but with -u myuser -p -A). Once this finished I restarted mysqld and it started without any errors in the logs.

I also needed to change the socket file directory, which I defined in the my.cnf file accordingly –


Cisco SNR adjustment

Go into global configuration mode and type the following:
service internal
int atm 0
dsl noise-margin (a value between -3 and 3)

Most likely you will need to increase the SNR for stability. You should check the SNR via the command show dsl interface atm0/0/0 or something like show controllers VDSL 0 (or what ever atm you need this doing on). To increase the SNR try settings dsl noise-margin 1 and then check the SNR value again. You can increment it by .5, so maybe 1, then 1.5 etc.. It will resync, and you should see the SNR increase. You can gradually increase until you have a stable connection.

Note that you will get a warning doing this – WARNING: Unsupported Command.  May cause violation to ADSL standards.