Location of MySQL database migration in Ubuntu

Source: Internet
Author: User

Ubuntu downloads and migrates the MySQL database and changes the MYSQL location for your reference.

First, create the directory to which the database will be migrated


Copy the original data in linux to the new directory.


Re-configure attributes for the new directory

Chown mysql: mysql/media/hdb1/db

Modify the file "/etc/apparmor. d/usr. sbin. mysqld"

Sudo vim/etc/apparmor. d/usr. sbin. mysqld


/Var/lib/mysql r,
/Var/lib/mysql/** rwk,


/Media/hdb1/db r,
/Media/hdb1/db/** rwk,

Modify directory

Sudo vim/etc/mysql/my. cnf

For example

Datadir =/var/mysql


Datadir =/media/hdb1/db

Enable server again

Sudo/etc/init. d/apparmor restart sudo/etc/init. d/mysql restart

Success !!!!

Note: The "Location of MySQL database migration under Ubuntu" introduced in this article comes from the city without any limitations, and the article is slightly changed.

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.