Today, I set up a newly purchased Alibaba Cloud ECS environment (Ubuntu 16.04 LTS). I need to save the MySQL data on the newly mounted disk (mounted to /mnt). First, I stop the MySQL service, and then check the location where the MySQL data is saved: vi /etc/mysql/mysql.conf.d/mysqld.cnf I found cp -r /var/lib/mysql /mnt chown -R mysql:mysql /mnt/mysql After the copy is complete, I thought everything was ready, so I started the mysql service: systemctl start mysql But I found that the startup failed, so I looked at the mysql error log: tail -f -n100 /var/log/mysql/error.log The error information is as follows: [Warning] Can't create test file /mnt/mysql/iZwz9c03srb2lq9l374if5Z.lower-test If you think about it carefully, there should be no problem with the mysql configuration. Check the apparmor configuration: vi /etc/apparmor.d/usr.sbin.mysqld The following configuration was found: # Allow data dir access /var/lib/mysql/ r, /var/lib/mysql/** rwk, What a pitfall. I just changed # Allow data dir access /var/lib/mysql/ r, /var/lib/mysql/** rwk, /mnt/mysql/ r, /mnt/mysql/** rwk, save. Restart the apparmor service: service apparmor restart Then start the mysql service again: systemctl start mysql The service finally started successfully. . . The above is the editor's introduction to solving the error problem caused by modifying mysql data_dir. I hope it will be helpful to everyone. If you have any questions, please leave me a message and I will reply to you in time. Thank you very much for your support of the 123WORDPRESS.COM website! You may also be interested in:
|
<<: Detailed explanation of the pitfalls of nginx proxy socket.io service
>>: The core process of nodejs processing tcp connection
download MySQL official download, select Windows ...
In many cases, in order to beautify the form, the ...
netem and tc: netem is a network simulation modul...
Table of contents Matlab Centroid Algorithm As a ...
Table of contents 1. Introduction to UDP and Linu...
As we all know, mailto is a very practical HTML ta...
<br />The website access speed can directly ...
1. What is it? MySQL is the most popular relation...
For any DBMS, indexes are the most important fact...
Preface Since the types of the same fields in the...
Preface In the previous article, we mainly learne...
Preface Recently, I encountered a requirement at ...
In this article, we’ll explore how async/await is...
A Brief Discussion on the Navigation Window in If...
This article briefly introduces how to install My...