默认mysql是禁止远程用户链接的。链接提示:mysql
1045,“Access denied for user 'root'@'192.168.100.1' (using password:YES)"sql
开启数据库远程链接便可:shell
一、先在本机使用root用户登陆mysql,而后进行受权。数据库
mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'youpassword' WITH GRANT OPTION;
在mysql控制台执行命令中的 ‘root'@'%' 能够这样理解: root是用户名,%是主机名或IP地址,这里的%表明任意主机或IP地址,你也可替换成任意其它用户名或指定惟一的IP地址;'MyPassword'是给受权用户指定的登陆数据库的密码安全
二、若是受权的时候提示以下,说明是密码过于简单。也能够下降数据库的安全级别。ui
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
三、受权成功以后重载受权表。spa
flush privileges;
四、退出数据库code
exit;
五、能够进行远程用户链接了。orm
2、下降数据库的安全级别:blog
刚安装的mysql的密码默认强度是最高的,若是想要设置简单的密码就要修改validate_password_policy的值,
validate_password_policy有如下取值:
Policy | Tests Performed |
---|---|
0 or LOW |
Length |
1 or MEDIUM |
Length; numeric, lowercase/uppercase, and special characters |
2 or STRONG |
Length; numeric, lowercase/uppercase, and special characters; dictionary file |
一、先登陆mysql
mysql -uroot -p
二、设置安全级别
set global validata_password_policy=0;
三、默认密码长度为8位,设置为4位。
set global validate_password_length=4;
四、而后再执行密码修改操做就不会提示:
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements