远程访问的设置命令:
USE mysql;
USE mysql;
UPDATE user SET host='%' WHERE user='root';
主要就是当中的: UPDATE user SET host='%' WHERE user='root';
Explain:
- 所建表默认存在mysql库里,host是该表连接到数据库的机器的host,
- 默认--'localhost',默认只有本机能够连接,重新设成'%',表示任意机器都行,远程连接为其子集可连接
重新设置密码: ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '你的密码';
登录设置: mysql -uroot(用户名) -ppassword(密码)