远程连接mysql数据库

环境:ubuntu16.04 LTS

在ubuntu中安装好mysql后,需要做以下配置才可以远程连接上

mysql配置里面:#bind-address = 127.0.0.1这句注释掉,或者改成mysql数据库服务端的ip地址

grant all privileges on mytest.* to ‘root’@‘需要连接该数据库的电脑的外网ip地址’ identified by ‘mysql的登陆密码’ with grant option;
或者
grant all on mytest.* to ‘root’@’%’ identified by ‘mysql的登陆密码’ ;
即privileges单词可以省略, with grant option也可以省略 , ‘root’@’%’ 代表所有ip都可以以root账户登录

如果出现报错:ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

说明你的密码强度不够,在mysql中执行下面两句:
set global validate_password_policy=0;
set global validate_password_length=4;
最后:flush privileges; 就可以了

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值