阅读更多
【问题1】
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (111)
【解决】
1、check listened port
[root@db-test ~]# netstat -tnulp|grep 3306
tcp 0 0 :::3306 :::* LISTEN 11781/mysqld
[root@db-test ~]#
2、connect to mysql with specified host
# mysql -uroot -h:: -p
3、input your passowrd in right,you will login successfully
【问题2】
[root@db-test mysql]# mysql -uroot -h:: -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.13
Copyright (c) 2000, 2016, 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> status;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
【解决】
mysql> SET PASSWORD = PASSWORD('passw0rd');
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('passw0rd');
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> status;
--------------
mysql Ver 14.14 Distrib 5.7.13, for linux-glibc2.5 (x86_64) using EditLine wrapper
Connection id: 3
Current database: mysql
Current user: root@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.7.13
Protocol version: 10
Connection: :: via TCP/IP
Server characterset: utf8mb4
Db characterset: latin1
Client characterset: utf8mb4
Conn. characterset: utf8mb4
TCP port: 3306
Uptime: 7 min 47 sec
Threads: 1 Questions: 56 Slow queries: 0 Opens: 137 Flush tables: 1 Open tables: 130 Queries per second avg: 0.119
--------------
mysql>