Solution to a typical error when installing and applying MySQL

Source: Internet
Author: User
After mysql, apache, and php are successfully installed on Linux, a database connection is compiled. the following error is reported on the php page: Can 'tconnecttolocalmysqlserverthroughsocket '/var/lib/mysql. sock I searched the internet and found a typical error. I even compiled a database connection after installing mysql, apache, and php on Linux. the following error is reported on the php page:
Can't connect to local MySQL server through socket '/var/lib/mysql. sock'
I searched the internet for a typical error. I searched some materials on google for a successful solution. I used the following methods:

Check the mysql error log to see what is going on. The error log here is in/var/lib/mysql /*. err you will invent mysql only, so it cannot be started. it is because/var/lib/mysql does not allow mysql service access. by default, mysql calls mysql users to start the service. As long
Chown-R mysql: mysql/var/lib/mysql
In this case, if the task cannot be started, you can debug the permission slowly. generally, if the task fails to be started, it is the title of the permission.

If you still cannot start it, you can use my complicated permission settings. I do this every time and generally do not have a title. for details, see:

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
Chgrp-R mysql/var/lib/mysql
Chmod 777/var/lib/mysql
Chown-R root/var/lib/mysql /*
Chgrp-R mysql/var/lib/mysql /*
Chmod 777/var/lib/mysql /*
Chmod 777/usr/local/mysql/lib/mysql/libmysqlclient.

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.