1、查看mysql安裝目錄
從目錄etc/my.cnf查看安裝目錄
2、進入mysql目錄,停止mysql服務
cd usr/local/mysql service mysql stop
(相關文章教學推薦:mysql影片教學)
#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相關文章教學推薦:
以上是mysql實作linux下資料庫目錄遷移的詳細內容。更多資訊請關注PHP中文網其他相關文章!