mysql在的远程连接访问
登录mysql server
使用命令行
mysql -h localhost -u root -p
-h 指定地址
-u 指定角色
-p 指定密码
出现没有授权给 [email protected]‘local’ 的问题
使用命令行root 进入mysql,设置root角色的密码:
select user, plugin from mysql.user;
设置新的密码
update mysql.user set authentication_string=PASSWORD(‘newPwd’), plugin=‘mysql_native_password’ where user=‘root’;
之后便可完成登录
远程连接权限问题
使用root角色登录mysql server;
use mysql;进入mysql数据库
select host,user from user;查看每个角色以及可以登录的地址
如果没有 % 的 root 角色,可以创建一个用户,使用如下命令:
grant all privileges on . to [email protected]’%’ identified by “password”;
表示root用户可以从任意的主机登录mysql server;
修改bind_address
mysql运行的时候回默认屏蔽来自其他地址的连接
修改mysql的配置文件
修改其中的 bind_address 即可(默认为127.0.0.1)
note:不可以使用多个ip地址表示指定的ip才可以登录