Mysql Data directory and Binlog directory relocation method _mysql

Source: Internet
Author: User
If the entire process uses a MySQL user, it should be able to start normally.
If the root user is used, it may not start properly because the new directory permissions are not correct.
This may be the wrong hint:
/usr/local/mysql/libexec/mysqld:file '/home/mysql/mysqllog/binlog/mysql-bin.index ' not Found (errcode:2)

1. Stop MySQL service must be stopped first, very important.
#/etc/init.d/mysqld Stop
2. Modify MySQL configuration my.cnf:

#datadir =/usr/local/mysql/var
#log-bin =/usr/local/mysql/var/binlog/mysql-bin

DataDir =/home/mysql/mysqldata
Log-bin =/home/mysql/mysqllog/binlog/mysql-bin

3. Copy MySQL Data
# cp-rf/usr/local/mysql/var/*/home/mysql/mysqldata/

4. Start MySQL Service
#/etc/init.d/mysqld Start

If the entire process uses a MySQL user, it should be able to start normally.
If the root user is used, it may not start properly because the new directory permissions are not correct.
Use the following command to modify it:
# chown Mysql:mysql/home/mysql-r

If you use InnoDB notice the following modifications:

Innodb_data_home_dir =/home/mysql/mysqldata/
Innodb_log_group_home_dir =/home/mysql/mysqldata/
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.