The default storage directory of mysql is This article uses MySQL 8.0.20, which is different from MySQL 8.0.11. For data migration of version 8.0.11, please see another blog: mysql8.0.11 data migration 1. Stop the mysql service first: service mysqld stop 2. Create the directory location where you need to store it and grant permissions: mkdir -p /bak/mysql_data chmod 766 /bak/mysql_data 3. Transfer the original data. Use cp -a to copy it (first enter the default directory /var/lib/ and copy the entire mysql directory): cp -a mysql /bak/mysql_data/ 4. Modify the mysql configuration file /etc/my.cnf: vim /etc/my.cnf Original settings: datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid Modified settings: datadir=/bak/mysql_data/mysql socket=/bak/mysql_data/mysql/mysql.sock log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid 5. Restart the mysql service: service mysqld restart mysql can start normally and it's OK~ This article uses MySQL 8.0.20, which is different from MySQL 8.0.11. For data migration of version 8.0.11, please see another blog: mysql8.0.11 data migration This is the end of this article about the method of migrating the data directory of MySQL 8.0.20. For more relevant content about MySQL data directory migration, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: UTF-8 and GB2312 web encoding
>>: A line of CSS code that crashes Chrome
System environment: Win10 64-bit MySQL version: m...
Today I found that a program inserted an incorrec...
Here is a brief summary of the installation and c...
Six steps of JDBC: 1. Register the driver 2. Get ...
introduction The previous article introduced the ...
The Docker container provides services and listen...
The role of the a tag pseudo-class: ":link&qu...
After installing the latest version 8.0.11 of mys...
This article uses an example to describe how to r...
Table of contents 1. MySQL replication related co...
This article shares the specific code for impleme...
Table of contents Case Study Update account balan...
Table of contents 1. Introduction to UDP and Linu...
Since I usually use the docker build command to g...
Preface The concept of dark mode originated from ...