Home > Database > Mysql Tutorial > mysql implements database directory migration under linux

mysql implements database directory migration under linux

王林
Release: 2020-01-28 21:37:14
forward
2253 people have browsed it

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
Copy after login

(Recommended related article tutorials: mysql video tutorial)

3. Move the entire mysql directory

cp -rf /usr/local/mysql/  home/mysql
Copy after login

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
Copy after login

5. Restart the service:

cd usr/local/mysql
service mysql start
Copy after login

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
Copy after login
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!

source:cnblogs.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template