启动成功后登录MySQL
[root@localhost ~]# /usr/local/mysql/bin/mysql -S /tmp/mysql3308.sock -A
mysql> use mysql;
Database changed
mysql> select version();
+------------+
| version() |
+------------+
| 5.7.19-log |
+------------+
1 row in set (0.00 sec)
mysql> select user,host from user;
+---------------+-----------+
| user | host |
+---------------+-----------+
| lepus | % |
| lepus_monitor | % |
| ssluser | % |
| mysql.session | localhost |
| mysql.sys | localhost |
| root | localhost |
+---------------+-----------+
6 rows in set (0.00 sec)
mysql> alter user 'root'@localhost identified by 'root';
Query OK, 0 rows affected (0.02 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.02 sec)
mysql> update user set host='%' where user='root';
Query OK, 1 row affected (0.01 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
mysql> select user,host from user;
+---------------+-----------+
| user | host |
+---------------+-----------+
| lepus | % |
| lepus_monitor | % |
| root | % |
| ssluser | % |
| mysql.session | localhost |
| mysql.sys | localhost |
+---------------+-----------+
6 rows in set (0.00 sec)
重新登录
[root@localhost ~]# /usr/local/mysql/bin/mysql -uroot -p -S /tmp/mysql3308.sock -A