国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 數(shù)據(jù)庫(kù) > MySQL > 正文

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

2024-07-24 12:41:42
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

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

原路徑:/var/lib/mysql

目標(biāo)路徑:/home/mysql_data/mysql

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

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

步驟:

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

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中的原路徑修改為目標(biāo)路徑

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

5、啟動(dòng)MySQL服務(wù)

systemctl start mysqld

NOTE:

1、報(bào)錯(cuò)如下:

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

再重新啟動(dòng)

2、報(bào)錯(cuò)如下:

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ù)庫(kù)數(shù)據(jù)文件路徑,希望對(duì)大家有所幫助,如果大家有任何疑問請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)武林網(wǎng)之家網(wǎng)站的支持!
如果你覺得本文對(duì)你有幫助,歡迎轉(zhuǎn)載,煩請(qǐng)注明出處,謝謝!

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 泽普县| 施甸县| 香河县| 博湖县| 濉溪县| 锦州市| 澳门| 应城市| 增城市| 淮滨县| 乌什县| 高陵县| 华阴市| 德庆县| 公主岭市| 六安市| 卢氏县| 晋江市| 库伦旗| 文水县| 新河县| 巫溪县| 岐山县| 临漳县| 浏阳市| 裕民县| 徐水县| 新竹市| 赣榆县| 宁德市| 时尚| 调兵山市| 嫩江县| 长沙县| 申扎县| 佛学| 雅江县| 平原县| 翁牛特旗| 集贤县| 米脂县|