Troubleshoot a typical error when installing a MySQL user

Source: Internet
Author: User
Tags chmod log mysql
mysql| Error | After I successfully installed mysql,apache,php on Linux, I edited a. php page that connected to the database, and reported the following error:
Can ' t connect to the local MySQL server through socket '/var/lib/mysql/mysql.sock '
I searched on the Internet, or a very typical mistake, I found some information on Google, a successful solution. I take the following methods:

Look at the MySQL error log to see what's going on, I'm here the error log is in/var/lib/mysql/*.err you'll find MySQL only so can't start because/var/lib/mysql permissions don't allow MySQL service access, English MySQL default is to invoke MySQL user to start the service. We just
Chown-r Mysql:mysql/var/lib/mysql
On the line, if you still can not start, and then slowly debug permissions, anyway, the general can not start is the issue of permissions.

If we still can not start, then use my more cumbersome permission settings, anyway, I do it every time, generally will not have problems, see below:

Chown-r Root/usr/local/mysql
Chgrp-r Mysql/usr/local/mysql
Chown-r Root/usr/local/mysql/bin
Chgrp-r Mysql/usr/local/mysql/bin
Chgrp-r Mysql/var/lib/mysql
chmod 777/var/lib/mysql
Chown-r Root/var/lib/mysql/mysql
Chgrp-r Mysql/var/lib/mysql/mysql
chmod 777/var/lib/mysql/mysql
Chown-r root/var/lib/mysql/mysql/*
Chgrp-r mysql/var/lib/mysql/mysql/*
chmod 777/var/lib/mysql/mysql/*
chmod 777/usr/local/mysql/lib/mysql/libmysqlclient.a



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.