1、查看mysql安裝目錄 從目錄etc/my.cnf中查看安裝目錄 2、進入mysql目錄,停止mysql服務 命令: cd usr/local/mysql 命令:service mysql stop 3、移動整個mysql目錄 命令:cp -rf /usr/local/mysql/ home/m ...
1、查看mysql安裝目錄
從目錄etc/my.cnf中查看安裝目錄
2、進入mysql目錄,停止mysql服務
命令: cd usr/local/mysql
命令:service mysql stop
3、移動整個mysql目錄
命令:cp -rf /usr/local/mysql/ home/mysql
4、修改my.cnf文件中mysql位置,並保存
[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、重啟服務:
命令: cd usr/local/mysql
命令:service mysql start
遇到問題:
Starting MySQL.The server quit without updating PID file (/home/local/mysql/data/localhost.localdomain.pid).
解決問題:修改/home/local/mysql/data目錄許可權
修改許可權命令: chown -R mysql.mysql /home/local/mysql/data