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

 

posted @ 2022-04-30 15:43  方诚  阅读(297)  评论(0编辑  收藏  举报