您好,欢迎访问本站博客! 请先 登录, 没有账号? 会员注册
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧
  • 网站部分资源来自网络,如有侵权请联系站长删除!

Mysql开放远程访问

Mysql Sena 2019-05-07 297 次浏览 0个评论

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


已有 297 位网友参与,快来吐槽:

发表评论