假设数据库原来的存放目录为/usr/local/mysql/var
新的目录为/var/mysql
1./usr/local/mysql/share/mysql/mysql.server stop
2.mkdir /var/mysql
chown -R mysql /var/mysql
chgrp -R mysql /var/mysql
3.vi /etc/my.cnf
add: datadir=/var/mysql
log-bin=/var/mysql/mysql-bin
4./usr/local/mysql/share/mysql/mysql.server start
转载请注明:duha.net » mysql更改数据存放目录