Solve a typical error when installing and using 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: CantconnecttolocalMySQLserverthroughsocketvarlibmysqlmysql. sock even searched the internet, which is still a typical error. I searched some information on google and solved it successfully. take the following steps:

After mysql, apache, and php are successfully installed on Linux, A. php page connecting to the database is compiled and the following error is reported:
Can't connect to local MySQL server through socket '/var/lib/mysql. sock'
I searched the internet for a typical error. I searched some information on google and successfully solved the problem. 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 find that mysql cannot be started only because/var/lib/mysql does not allow access to the mysql service. by default, mysql calls the mysql User to start the service. As long
Chown-R mysql: mysql/var/lib/mysql
That's it. if it still cannot be started, you can debug the permission slowly. generally, it is a permission issue if it cannot be started.

If you still cannot start it, use my complicated permission settings. I do this every time. Generally, there is no problem. 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.