mysql设置远程访问权限,允许其他IP访问
【代码】mysql设置允许其他IP访问。
·
文章目录
更改mysql配置文件
查找.ini
或者.cnf文件
- 更改
bind-address
为0.0.0.0
[mysqld]
character-set-server=utf8mb4
bind-address=0.0.0.0
default-storage-engine=INNODB
[mysql]
default-character-set=utf8mb4
[client]
default-character-set=utf8mb4
登录mysql
mysql -u root -p
输入密码
E:\mysql-8.0.22-winx64\bin>mysql -u root -p
Enter password: ****
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 21
Server version: 8.0.22 MySQL Community Server - GPL
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
- 使用
mysql
use mysql;
mysql> use mysql;
Database changed
- 查看目前
mysql
的用户和host
select user,host from user;
mysql> select user,host from user;
+------------------+-----------+
| user | host |
+------------------+-----------+
| username | % |
| mysql.infoschema | localhost |
| mysql.session | localhost |
| mysql.sys | localhost |
| root | localhost |
+------------------+-----------+
5 rows in set (0.03 sec)
- 更改
root
用户的host
为全部
mysql> update user set host = '%' where user = 'root';
Query OK, 1 row affected (0.02 sec)
Rows matched: 1 Changed: 1 Warnings: 0
开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!
更多推荐
已为社区贡献3条内容
所有评论(0)