the reason for the error is very simple: MySQL should be used instead of MySQL when starting the command server
mac brew install mysql
Install MySQL with homebrew on Mac to perfectly solve error 2002 (HY000):
Can’t connect to local MySQL server through socket ‘/tmp/mysql.Sock ‘(2) error
1. Start the command mysql server
the startup method of using MySQL command directly is wrong
This problem occurs when you directly call the MySQL command. It is said on the Internet that it is because of MySQL Caused by CNF configuration file.
the correct startup method is mysql server
➜ support-files mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
➜ support-files pwd
/opt/homebrew/opt/mysql/support-files
➜ support-files ls
mysql-log-rotate mysql.server mysqld_multi.server
2. my.CNF file location
my.CNF file location
➜ homebrew cd etc
➜ etc ls
bash_completion.d ca-certificates dump.rdb my.cnf [email protected]
redis-sentinel.conf redis.conf
➜ etc pwd
/opt/homebrew/etc
3. MySQL installation location
➜ homebrew cd opt
➜ opt ls
ca-certificates jasper libevent libpng lz4 [email protected] pzstd six
devil jpeg libjpeg libtiff mysql protobuf redis zlib
icu4c lcms2 libjpg little-cms2 [email protected] [email protected] [email protected] zstd
➜ opt cd mysql
➜ mysql ls
INSTALL_RECEIPT.json LICENSE.router README.router homebrew.mxcl.mysql.plist lib support-files
LICENSE README bin homebrew.mysql.service mysqlrouter-log-rotate
LICENSE-test README-test docs include share
➜ mysql pwd
/opt/homebrew/opt/mysql
➜ mysql
Read More:
- MySql Install Error: Can‘t connect to local MySQL server through socket ‘/tmp/mysql.sock‘
- [Solved] MYSQL Command Execute Error: Can ‘t connect to local MySQL server through socket ‘/tmp/mysql.sock ‘(2) “
- ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’
- [Solved] ERROR 2002 (HY000): Can’t connect to local MySQL server through socket’/var/lib/mysql/mysql.sock’ (2)
- How to Solve can‘t connect to local mysql server through socket ‘/var/lib/mysql/mysql.sock‘
- [Solved] FATAL ERROR: please install the following Perl modules before executing /application/mysql/scripts/mysql_install_db: Data::Dumper
- Mysql Flashback Warning: C:\Program Files\MySQL\MySQL Server 8.0\bin\mysql.exe
- ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’
- MySQL Install Error: MySQL error 1042: Unable to connect to any of the specified MySQL hosts
- MySQL Error: Error writing file ‘/tmp/MY4WYVlC‘ (Errcode: 28 – No space left on device)
- MAC MYSQL Start Error: The server quit without updating PID
- [Solved] CentOS installs MySQL and starts MySQL with error 2002 (HY000)
- MYSQL 5.7 Error Code: 1290. The MySQL server is running with the –secure-file-priv option so it..
- [Solved] MYSQL Error: ERROR! MySQL server PID file could not be found!
- [Solved] Django configures MySQL Error: NameError: name ”_MySQL ‘is not defined
- MYSQL Enter password:ERROR 2003 (HY000): Can‘t connect to MySQL server on ‘localhost:3306‘
- [Solved] MySQL Install Error: GPG check FAILED
- (Fixed) workbench MySQL Error Code: 2013. Lost connection to MySQL server during query
- MYSQL Insert Data Error: check the manual that corresponds to your MySQL server version for the right syntax
- How to Fix MySQL ERROR 1130 (HY000): Host ‘XXXX’ is not allowed to connect to this MySQL server