濮阳杆衣贸易有限公司

主頁 > 知識庫 > Linux下修改MySQL數(shù)據(jù)庫數(shù)據(jù)文件路徑的步驟

Linux下修改MySQL數(shù)據(jù)庫數(shù)據(jù)文件路徑的步驟

熱門標簽:400電話申請信用卡 巫師三血與酒地圖標注 萊西市地圖標注 在哪里申請400電話 銷售語音電話機器人 外呼系統(tǒng)電銷受騙 走過哪個省地圖標注 常州網(wǎng)絡(luò)外呼系統(tǒng)開發(fā) 安徽ai電話電銷機器人有效果嗎

使用rpm安裝方式安裝完MySQL數(shù)據(jù)庫后,數(shù)據(jù)文件的默認路徑為/var/lib/mysql,然而根目錄并不適合用于存儲數(shù)據(jù)文件。

原路徑:/var/lib/mysql

目標路徑:/home/mysql_data/mysql

Linux系統(tǒng)版本:centos7.6

MySQL數(shù)據(jù)庫版本:5.7.25

步驟:

1、創(chuàng)建目標路徑

mkdir -p /home/mysql_data

2、關(guān)閉MySQL

systemctl stop mysqld

3、復(fù)制數(shù)據(jù)文件

cp -arp /var/lib/mysql /home/mysql_data

4、修改配置文件/etc/my.cnf

將datadir和socket中的原路徑修改為目標路徑

datadir=/home/mysql_data/mysql
socket=/home/mysql_data/mysql/mysql.sock

5、啟動MySQL服務(wù)

systemctl start mysqld

NOTE:

1、報錯如下:

2019-12-22T08:32:42.430564Z 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2019-12-22T08:32:42.430599Z 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2019-12-22T08:32:42.430616Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2019-12-22T08:32:42.430898Z 0 [ERROR] InnoDB: The innodb_temporary data file 'ibtmp1' must be writable
2019-12-22T08:32:42.430923Z 0 [ERROR] InnoDB: The innodb_temporary data file 'ibtmp1' must be writable
2019-12-22T08:32:42.430936Z 0 [ERROR] InnoDB: Could not create the shared innodb_temporary.
2019-12-22T08:32:42.430952Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2019-12-22T08:32:43.038973Z 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2019-12-22T08:32:43.039021Z 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2019-12-22T08:32:43.039037Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2019-12-22T08:32:43.039046Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2019-12-22T08:32:43.039056Z 0 [ERROR] Failed to initialize builtin plugins.
2019-12-22T08:32:43.039063Z 0 [ERROR] Aborting

解決:

執(zhí)行命令:

setenforce 1

再重新啟動

2、報錯如下:

Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'

解決:

修改配置文件my.cnf,添加或修改如下配置:

[client]
socket = /home/mysql_data/mysql/mysql.sock

總結(jié)

以上所述是小編給大家介紹的Linux下修改MySQL數(shù)據(jù)庫數(shù)據(jù)文件路徑,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復(fù)大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!
如果你覺得本文對你有幫助,歡迎轉(zhuǎn)載,煩請注明出處,謝謝!

您可能感興趣的文章:
  • window與linux項目部署之linux文件路徑不存在問題
  • 詳解kali linux 常用文件與指令路徑
  • Linux中如何查詢運行文件的全路徑的方法
  • linux中tar打包指定路徑文件的實現(xiàn)方法
  • linux中通過文件描述符獲取文件絕對路徑的方法
  • 查看linux服務(wù)器上mysql配置文件路徑的方法
  • linux修改mysql數(shù)據(jù)庫文件的路徑
  • 基于linux命令提取文件夾內(nèi)特定文件路徑

標簽:黃石 來賓 煙臺 鞍山 赤峰 陽江 果洛 河北

巨人網(wǎng)絡(luò)通訊聲明:本文標題《Linux下修改MySQL數(shù)據(jù)庫數(shù)據(jù)文件路徑的步驟》,本文關(guān)鍵詞  Linux,下,修改,MySQL,數(shù)據(jù)庫,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《Linux下修改MySQL數(shù)據(jù)庫數(shù)據(jù)文件路徑的步驟》相關(guān)的同類信息!
  • 本頁收集關(guān)于Linux下修改MySQL數(shù)據(jù)庫數(shù)據(jù)文件路徑的步驟的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    黑龙江省| 嵩明县| 双流县| 曲靖市| 海门市| 林州市| 陆良县| 鄂托克旗| 梧州市| 巢湖市| 衡水市| 浦城县| 江安县| 南澳县| 岱山县| 伊川县| 恩平市| 遂昌县| 水城县| 长丰县| 渝北区| 威宁| 杭锦旗| 聊城市| 双桥区| 望奎县| 绵竹市| 莒南县| 日喀则市| 岑溪市| 中宁县| 郑州市| 梁平县| 大港区| 太康县| 祁阳县| 泽州县| 天峨县| 新沂市| 蓝山县| 万载县|