培森的Blog Mysql开放远程访问

Mysql开放远程访问

登陆Mysql数据库   mysql -u root -p …

登陆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]>

本文来自网络,不代表培森的Blog立场,转载请注明出处:https://blog.xupeisen.com/archives/100

作者: 培森

联系我们

联系我们

13262951234

在线咨询: QQ交谈

邮箱: admin@xupeisen.com

工作时间:周一至周五,9:00-17:30,节假日休息

关注微信
微信扫一扫关注我们

微信扫一扫关注我们

关注微博
返回顶部