datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
log-error=/var/log/mysqld.log
datadir=/home/mysql
socket=/home/mysql/mysql.sock
log-error=home/mysql_log/mysqld.log
service mysqld stop
cp -arp /var/lib/mysql /home/mysql
将路径进行更换
datadir=/home/mysql
socket=/home/mysql/mysql.sock
log-error=home/mysql_log/mysqld.log
chown -R mysql:mysql /home/mysql
chown -R mysql:mysql /home/mysql_log/
在mysql运行时会产生mysql.sock文件,需与新地址进行链接
将旧地址生成的mysql.sock拷贝到新的路径,并进行链接
ln -s /home/mysql/mysql.sock /var/lib/mysql/mysql.sock
service mysqld start
show variables like 'datadir';