Notes on migrating MySQL data directory from CentOS

https://www.tecmint.com/change-default-mysql-mariadb-data-directory-in-linux/

Need to pay attention to this step:

Step 4: Set SELinux Security Context to Data Directory

This step is only applicable to RHEL /CentOS and its derivatives.

Add the SELinux security context to /mnt/mysql-data before restarting MariaDB.

# semanage fcontext -a -t mysqld_db_t "/mnt/mysql-data(/.*)?"
# restorecon -R /mnt /mysql-data

Otherwise, MySQL will never start.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326157293&siteId=291194637