How to mount the MySQL database directory to a data disk in CentOS

Source: Internet
Author: User

Generally, we will give a system disk when purchasing VPS, which is generally between 10 GB and 40 GB. When there is a large amount of data on your website, we will consider purchasing a data disk, then place the website data and MySQL database storage directory on the mounted data disk, so that the system disk will not be fully occupied. Of course, another benefit is that no matter what problems occur to your system disk, it does not affect your database and website data.

Once your system disk is full, database startup will fail.

The Xen architecture host and Tencent Cloud host will appear. According to some friends, Tencent Cloud is allocated 8 GB.

How to modify the MySQL data storage directory in CentOS in linux

1. The environment of the blogger is the one-click LNMP package of June, and MariaDB is used for the database. The storage directory seems to be different from that of MySQL, but the operation principle is the same.

2. The database installation directory is "/usr/local/mariadb", and the data storage directory is in "/usr/local/mariadb/var.

3. go to the "/usr/local/mariadb" directory and move the "var" directory to the data disk. The data disk of the blogger is mounted on "/data". The operation command is:

Mv/usr/local/mariadb/var/data

4. Run the "/data/var" soft link. The command is as follows:

Ln-s/data/var/usr/local/mariadb/

5. Restart the database. The command is as follows:

Mysql restart

Then you can check whether it is normal.

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.