Windows安装MySQL后怎么开启root的网络访问权限

Windows安装MySQL后默认只能本机访问,怎么开启网络访问

mysql> create user 'root'@'%' identified by 'password';
Query OK, 0 rows affected (0.00 sec)

mysql> grant all on *.* to 'root'@'%';
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

MySQL8.0的设置方法一样
如果报以下错误

ERROR 1396 (HY000): Operation CREATE USER failed for 'root'@'%'

则删除用户重新运行一遍授权

drop user root@'%';
posted @ 2023-08-19 14:07  minseo  阅读(47)  评论(0编辑  收藏  举报