CentOS7开启MySQL远程登录
- 登录mysql数据库
mysql -u root -p '你的密码'
- 查看user表
mysql> use mysql; mysql> select Host,User,Password from user; ERROR 1054 (42S22): Unknown column 'Password' in 'field list' mysql> select Host,User from user; +-----------+---------------+ | Host | User | +-----------+---------------+ | localhost | mysql.session | | localhost | mysql.sys | | localhost | root | +-----------+---------------+ #Host主机,User用户
- 开启远程访问权限
mysql> grant all privileges on *.* to root@'%' identified by "你的mysql密码"; Query OK, 0 rows affected, 1 warning (0.00 sec) #%代表所有主机,也可以写ip地址
- 重新加载权限数据
mysql> flush privileges; #重新加载权限数据 Query OK, 0 rows affected (0.00 sec)
- 之后就可以远程连接了
本文来自博客园,作者:手可摘星辰/*,转载请注明原文链接:https://www.cnblogs.com/u-damowang1/p/14749290.html