mysql-5.7.21 start error, modify database storage directory

Source: Internet
Author: User
Tags mkdir
mysql-5.7.21 start error, Permanent solution
chmod +x/etc/rc.d/rc.local
#往里面写入两条命令, which means to automatically create mysqld and modify owner permissions for boot
Ehco "Mkdir-p/var/run/mysqld
Chown-r Mysql:mysql/etc/var/mysqld
"/etc/rc.d/rc.local

#修改数据库存放目录
Systemctl Stop Mysqld #将数据库服务器停止
Mkdir-p/data/mysql/#创建目录
Chown-r Mysql:mysql/data/mysql #修改文件夹所有者
Cp-r/var/lib/mysql/ /data/mysql
Chown-r mysql:mysql/data/mysql/

Ls-l/data/mysql/
Vi/etc/my.cnf
Datadir=/data/mysql
Socket=/data/mysql/mysql.sock

Save exit
Systemctl Start mysqld
Systemctl Status Mysqld

mysql-5.7.21 start error, modify database storage directory

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.