mysql修改datadir目录
mysql> show variables like "%datadir%"; +---------------+-----------------+ | Variable_name | Value | +---------------+-----------------+ | datadir | /var/lib/mysql/ | +---------------+-----------------+ 1 row in set (0.01 sec)
mysql> shutdown; Query OK, 0 rows affected (0.00 sec)
cp -r /var/lib/mysql ./db1
chown -R mysql.mysql db1
vim /etc/mysql/my.cnf
datadir=/source/data/mysql/db1
/etc/init.d/mysql start