brew install mysql 安装数据库无法启动的问题解决(不要用密码启动 ➜ ~ mysql -u root)

1)brew安装完mysql后,直接运行报错如下:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

2)解决

➜  ~ sudo mysql.server start
Password:
Starting MySQL
.Logging to '/usr/local/var/mysql/jianandeMacBook-Pro.local.err'.
 ERROR! The server quit without updating PID file (/usr/local/var/mysql/jianandeMacBook-Pro.local.pid).


➜  ~ mysqld
2019-12-05T02:54:46.027864Z 0 [System] [MY-010116] [Server] /usr/local/Cellar/mysql/8.0.18_1/bin/mysqld (mysqld 8.0.18) starting as process 3597
2019-12-05T02:54:46.031155Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive
2019-12-05T02:54:46.573337Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2019-12-05T02:54:46.604675Z 0 [System] [MY-010931] [Server] /usr/local/Cellar/mysql/8.0.18_1/bin/mysqld: ready for connections. Version: '8.0.18'  socket: '/tmp/mysql.sock'  port: 3306  Homebrew.
2019-12-05T02:54:46.712947Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: '/tmp/mysqlx.sock' bind-address: '127.0.0.1' port: 33060
 

➜  ~ sudo mysqld_safe
Password:
Logging to '/usr/local/var/mysql/jianandeMacBook-Pro.local.err'.
2019-12-05T02:55:09.6NZ mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql
2019-12-05T02:55:09.6NZ mysqld_safe mysqld from pid file /usr/local/var/mysql/jianandeMacBook-Pro.local.pid ended

➜  ~ mysql -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.18 Homebrew

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

 

参考:https://www.jianshu.com/p/d9790602b9d5

 

 

-------------------20191218

➜  ~ mysql -u root -p
Enter password:123456
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.18 Homebrew

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

 

你可能感兴趣的:(mysql)