Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to modify the path of MySQL database data file in Linux

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

Today, I will talk to you about how to modify the path of MySQL database data files in Linux. Many people may not know much about it. In order to make you understand better, the editor has summarized the following contents for you. I hope you can get something according to this article.

Steps:

1. Create the target path

Mkdir-p / home/mysql_data

2. Close MySQL

Systemctl stop mysqld

3. Copy data files

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

4. Modify the configuration file / etc/my.cnf

Modify the original path in datadir and socket to the target path

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

5. Start the MySQL service

Systemctl start mysqld

NOTE:

1. The error is as follows:

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

Resolve:

Execute the command:

Setenforce 1

Restart again

2. The error report is as follows:

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

Resolve:

Modify the configuration file my.cnf to add or modify the following configuration:

[client] socket = / home/mysql_data/mysql/mysql.sock after reading the above, do you have any further understanding of how to modify the path of the MySQL database data file in Linux? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report