Ubuntu Mysql 5.7 datadir Data Catalog modification

Source: Internet
Author: User
Tags mysql command line

Today to modify the Ubuntu under the MySQL 5.7 Data directory, found no matter how to toss files

/etc/mysql/my.cnf

After the restart is not valid, in the online view of the relevant documents, said to modify the AppArmor file, to organize the document, the steps to write the following.

Version information for the system:

[Email protected] Virtual-machine:~$ uname-a Linux DC-virtual4.10. 0--generic #16.04. 1  - x86_64:x86_64 x86_64 gnu/linux

1. Create a new database directory and modify the owning and owning group

2. Modify the configuration file/etc/my.cnf, if can not find/etc/mysql/my.cnf, if not found, sorry to find a relay it;

Modify DataDir to the directory defined in 1:

DataDir =/var/mysql_data

3. This step is important to modify the relevant configuration file for AppArmor

or modify the file

sudo vim/etc/apparmor/usr.bin.mysqld

may also be under the other path, pay attention to carefully find, this file I also later know, in CentOS, there is no such step.

In the above file:

dir Access   /var/lib/MySQL R,  /var/lib/mysql*/* RWK,

Note: The/var/lib/mysql/directory above is the default after MySQL is installed.

Modified to:

dir Access   /var/mysql_data/ R,  /var/mysql_data*/* RWK,

4. Restart the AppArmor service after the modification is complete

Sudo/etc/init.d/apparmor  Restart

5. Restart the MySQL service

sudo service MySQL restart

6. Verify that the MySQL directory has changed

Go to the MySQL command line and execute:

Show variables like '%datadir% '

Can.

Ubuntu Mysql 5.7 datadir Data Catalog modification

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.