修改数据库密码
cd到数据库bin路径下
mysql.exe -u root -p
登录成功
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
再打开一个cmd重新登陆
mysql.exe -u root -p
登录成功开启外部访问数据库
回到上层路径找到my.ini
将内容bind-address
行注释掉或者改成0.0.0.0
不存在则跳过
#bind-address = 127.0.0.1 bind-address = 0.0.0.0
登录数据库,将root用户对应的host地址修改成%
use mysql
update user set host = '%' where user = 'root'; flush privileges;
赋权
GRANT ALL ON *.* TO `root`@`%` WITH GRANT OPTION; flush privileges;
工具连接,发现报错
修改mysql认证方式为mysql_native_password
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456'; FLUSH PRIVILEGES;
再次测试连接,连接成功
标签:bind,0.0,数据库,MySQL,密码,mysql,root,address From: https://www.cnblogs.com/leonlipfsj/p/18349929