Home >Database >Mysql Tutorial >mysql implements database directory migration under linux
1. Check the mysql installation directory
Check the installation directory from the directory etc/my.cnf
2. Enter the mysql directory and stop the mysql service
cd usr/local/mysql service mysql stop
(Recommended related article tutorials: mysql video tutorial)
3. Move the entire mysql directory
cp -rf /usr/local/mysql/ home/mysql
4. Modify the my.cnf file mysql location and save it
[client] default-character-set=utf8 [mysqld] character-set-server=utf8 datadir=/home/mysql/data basedir=/home/mysql socket=/home/mysql/tmp/mysql.sock lower_case_table_names=1 [mysqld_safe] log-error=/home/mysql/log/mysqld.log
5. Restart the service:
cd usr/local/mysql service mysql start
Encountered the following problem:
Starting MySQL.The server quit without updating PID file (/ home/local/mysql/data/localhost.localdomain.pid).
chown -R mysql.mysql /home/local/mysql/dataRecommended related articles and tutorials:
The above is the detailed content of mysql implements database directory migration under linux. For more information, please follow other related articles on the PHP Chinese website!