Mac OS start MySQL failed ERROR 2002 HY000

Source: Internet
Author: User
Tags macbook
bogon:~ ksoul$ mysql -uroot -pEnter password: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

MYSQL-5.6.24-OSX10.9-X86_64.DMG downloaded through the MySQL website double-click the next installation, but the start is successful, but a run error. System is MacBook Air OS 10.10.2

Add:
In the SG copied a configuration copy into the /usr/local/mysql/my.cnf can, but strange things. The link address in the phpMyAdmin must be used 127.0.0.1 .

[client]port = 3306socket = /tmp/mysql.socketdefault-character-set = utf8[mysqld]collation-server = utf8_unicode_cicharacter-set-server = utf8init-connect = 'SET NAMES utf8'max_allowed_packet = 64Mbind-address = 127.0.0.1port = 3306socket = /tmp/mysql.sockinnodb_file_per_table = 1[mysqld_safe]timezone = '+0:00'

Reply content:

bogon:~ ksoul$ mysql -uroot -pEnter password: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

MYSQL-5.6.24-OSX10.9-X86_64.DMG downloaded through the MySQL website double-click the next installation, but the start is successful, but a run error. System is MacBook Air OS 10.10.2

Add:
In the SG copied a configuration copy into the /usr/local/mysql/my.cnf can, but strange things. The link address in the phpMyAdmin must be used 127.0.0.1 .

[client]port = 3306socket = /tmp/mysql.socketdefault-character-set = utf8[mysqld]collation-server = utf8_unicode_cicharacter-set-server = utf8init-connect = 'SET NAMES utf8'max_allowed_packet = 64Mbind-address = 127.0.0.1port = 3306socket = /tmp/mysql.sockinnodb_file_per_table = 1[mysqld_safe]timezone = '+0:00'

The information for the prompt is clear and the Mysql.sock file cannot be found. PHP.ini The default configuration path is/tmp/mysql.sock, but the Mac OS under MySQL default installation mysql.sock file is not necessarily this location (specifically I have not verified). You specify where this file is generated from the configuration of the SG copy

Socket =/tmp/mysql.socket

MySQL will put this sock file here when it restarts.

Tips: This file is only used when accessing MySQL server via localhost (that is, a UNIX socket), not through IP access. This may be the reason why you phpMyAdmin be able to access the database over IP.

Not very understanding. Combined with the previous question, I think you might be using Mac OS X for the first time:

It is recommended to use homebrew to install MySQL and other software, brew equivalent to the Yum on CentOS.

Restart MySQL
Re-Login
Make sure your password is not error-free.

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
Determine whether a file exists or a permissions issue

I have encountered this problem before, this seems to be the latest version of the MySQL bug, I was downgraded to 5.1.73 after the use of, do not know that now solved no ...

Check your php.ini configuration. One of my previous notes, you can refer to, hope to help you.

Http://www.netingcn.com/mac-os-lion-php-mysql-localhost.html

  • 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.