Home  >  Article  >  Database  >  mysql implements database directory migration under linux

mysql implements database directory migration under linux

王林
王林forward
2020-01-28 21:35:052197browse

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).

mysql implements database directory migration under linux

##The solution is as follows:

Modify /home/ Local/mysql/data directory permissions, the command is as follows:

chown -R mysql.mysql /home/local/mysql/data

Recommended related articles and tutorials:

mysql tutorial

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!

Statement:
This article is reproduced at:cnblogs.com. If there is any infringement, please contact admin@php.cn delete