登陆Mysql数据库
mysql -u root -p
[root@instance-nn0mkqqb ~]# mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 4 Server version: 5.5.60-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> 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 MariaDB [mysql]> select host,user,password from user; +-------------------+------+-------------------------------------------+ | host | user | password | +-------------------+------+-------------------------------------------+ | localhost | root | *B80569BFE12A94ECE65A4A9312FCE36A5CDA94D3 | | instance-nn0mkqqb | root | | | 127.0.0.1 | root | | | ::1 | root | | | localhost | | | | instance-nn0mkqqb | | | +-------------------+------+-------------------------------------------+ 6 rows in set (0.00 sec) MariaDB [mysql]> update user set host = '%' where user = 'root' and host = 'localhost'; Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0 MariaDB [mysql]> flush privileges; Query OK, 0 rows affected (0.00 sec) MariaDB [mysql]> select host,user,password from user; +-------------------+------+-------------------------------------------+ | host | user | password | +-------------------+------+-------------------------------------------+ | % | root | *B80569BFE12A94ECE65A4A9312FCE36A5CDA94D3 | | instance-nn0mkqqb | root | | | 127.0.0.1 | root | | | ::1 | root | | | localhost | | | | instance-nn0mkqqb | | | +-------------------+------+-------------------------------------------+ 6 rows in set (0.00 sec) MariaDB [mysql]>