liunx mysql database directory migration

1, see the mysql installation directory

     Review the installation directory from the directory etc / my.cnf in

2, enter the directory mysql, mysql stop service

  Command: cd usr / local / mysql

  Command: service mysql stop

3, moving the entire mysql directory

       命令:cp -rf /usr/local/mysql/  home/mysql

4, modify the mysql my.cnf file location and save

  [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:

  Command: cd usr / local / mysql

  Command: service mysql start

 

Encounter problems:

Starting MySQL.The server quit without updating PID file (/home/local/mysql/data/localhost.localdomain.pid).

 

To solve the problem: Modify / home / local / mysql / data directory permissions

Modify authority to order: chown -R mysql.mysql / home / local / mysql / data

 

Guess you like

Origin www.cnblogs.com/seeyou1993/p/11585695.html