Mysql error-Modify mysql. sock location

Source: Internet
Author: User

Mysql error-Modify mysql. sock location

Sometimes Mysql. sock location errors may occur in mysql, resulting in the inability to connect to the database.

When an error is reported in mac:

First modify my. cnf

The location is under/etc/my. cnf. If not, modify it under/usr/locate/mysql/my. cnf and copy it to/etc.

To:

[client]socket = /tmp/mysql.sock[mysqld]socket = /tmp/mysql.sock

If there is no [client], add it yourself ~

Then restart the mysql service and open mysql to see if the location has changed ~ Use, view status

mysql  Ver 14.14 Distrib 5.6.17, for osx10.7 (x86_64) using  EditLine wrapperConnection id:24Current database:Current user:root@localhostSSL:Not in useCurrent pager:lessUsing outfile:''Using delimiter:;Server version:5.6.17 MySQL Community Server (GPL)Protocol version:10Connection:Localhost via UNIX socketServer characterset:utf8Db     characterset:utf8Client characterset:utf8Conn.  characterset:utf8UNIX socket:/tmp/mysql.sockUptime:15 min 51 sec

If php. ini (the location is/etc/php. ini) is not found, copy a php. ini. default file.

In:

pdo_mysql.default_socket=/tmp/mysql.sockmysql.default_socket = /tmp/mysql.sockmysqli.default_socket = /tmp/mysql.sock

All three are modified ~

Then

sudo apachectl stopsudo apachectl start

You can ~

Check whether mysql. sock has changed under phpinfo ~

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.