Mysql-安装指南

it2024-08-17  63

 

 

 

1、设置用户名密码

首次登录后修改密码如下:

如果密码设置太过简单会报以下错误

mysql修改密码Your password does not satisfy the current policy requirements

出现这个问题的原因是:密码过于简单。刚安装的mysql的密码默认强度是最高的,如果想要设置简单的密码就要修改validate_password_policy的值,

validate_password_policy有以下取值:

 

PolicyTests Performed0 or LOWLength1 or MEDIUMLength; numeric, lowercase/uppercase, and special characters2 or STRONGLength; numeric, lowercase/uppercase, and special characters; dictionary file

默认是1,因此我们就设置中增加大小写和特殊字符即可。

 

2、配置允许外网连接

 

 

2.登录数据库mysql -u root -p#输入密码

3.转到系统数据库mysql> use mysql;

4.查询hostmysql> select user,host from user;

5.创建host#如果没有"%"这个host值,就执行下面这两句:mysql> update user set host='%' where user='root';mysql> flush privileges;

6.授权用户#任意主机以用户root和密码mypwd连接到mysql服务器mysql> grant all privileges on *.* to 'root'@'%' identified by 'mypwd' with grant option;

#IP为192.168.1.100的主机以用户myuser和密码mypwd连接到mysql服务器mysql> grant all privileges on *.* to 'myuser'@'192.168.1.100' identified by 'mypwd' with grant option;

7.刷新权限mysql> flush privileges;

操作截图如下:

 

 

 

 

忘记密码参考:

CentOS7 通过YUM安装MySQL5.7

参考:

1 设置MySQL允许外网访问

2 CentOS7 通过YUM安装MySQL5.7

 

转载于:https://www.cnblogs.com/snowwhite/p/9903477.html

最新回复(0)