mysql账户添加远程访问

Posted 流火行者

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql账户添加远程访问相关的知识,希望对你有一定的参考价值。

我们要将root账户设置为远程可访问

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| here               |
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+

选择mysql数据库
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> show tables;
+---------------------------+
| Tables_in_mysql           |
+---------------------------+
| columns_priv              |
| component                 |
| db                        |
| default_roles             |
| engine_cost               |
| func                      |
| general_log               |
| global_grants             |
| gtid_executed             |
| help_category             |
| help_keyword              |
| help_relation             |
| help_topic                |
| innodb_index_stats        |
| innodb_table_stats        |
| password_history          |
| plugin                    |
| procs_priv                |
| proxies_priv              |
| role_edges                |
| server_cost               |
| servers                   |
| slave_master_info         |
| slave_relay_log_info      |
| slave_worker_info         |
| slow_log                  |
| tables_priv               |
| time_zone                 |
| time_zone_leap_second     |
| time_zone_name            |
| time_zone_transition      |
| time_zone_transition_type |
| user                      |
+---------------------------+

mysql> update user set Host = ‘%‘ where User=‘root‘;
Query OK, 1 row affected (0.13 sec)
Rows matched: 1  Changed: 1  Warnings: 0

最后要刷新一下执行这个
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

然后就可以了

以上是关于mysql账户添加远程访问的主要内容,如果未能解决你的问题,请参考以下文章

如何打开MySQL中root账户的远程登录

如何打开MySQL中root账户的远程登录

远程连接mysql 授权方法详解

RabbitMQ远程访问配置

mysql 的远程链接字符

MySql实现远程访问配置