my database files located in /var/lib/mysql
which located in partition /dev/sda5
this partition is full (refer here for details)
so I'm going to move the location of database files from /var/lib/mysql
to /home/lib/mysql
What is the right way to move this database files?
Im going to do this steps:
- Stop http server and PHP
- Change
datadir=/var/lib/mysql
to becomedatadir=/home/lib/mysql
in/etc/my.cnf
- move all database files to the new location
- run
killall -9 mysql
, then/etc/init.d/mysqld start
- Start http server and PHP
Is this right? Correct me if I'm wrong
added:
currently, mysql won't stop. refer here: mysql wont stop, mysqld_safe appeared in top
1- You should stop the mysql server (step 4) before moving the files (step 3).
2- You should stop it gracefully not using
kill -9
unless needed to.3- I think you mean start in step 5. (I edit the question).
4- You need also to check the files permissions and ownership.