当前位置: 移动技术网 > 网络运营>服务器>Linux > CentOS7使用dnf安装mysql的方法

CentOS7使用dnf安装mysql的方法

2019年04月20日  | 移动技术网网络运营  | 我要评论

本文介绍了centos7使用dnf安装mysql的方法,分享给大家,具体如下:

1.安装mysql的yum仓库

执行以下命令:

复制代码 代码如下:

yum localinstall

2.安装mysql

dnf install mysql-community-server

3.开启mysql服务

service mysql start

4.查找默认密码

为了加强安全性,mysql5.7为root用户随机生成了一个密码,在error log中,关于error log的位置,如果安装的是rpm包,则默认是/var/log/mysqld.log。

只有启动过一次mysql才可以查看临时密码,输入以下命令查看密码:

grep 'temporary password' /var/log/mysqld.log

输出如下:

[root@vm_0_13_centos init.d]# grep 'temporary password' /var/log/mysqld.log                                                   
2018-03-09t13:03:32.859149z 1 [note] a temporary password is generated for : ivxhn:4e3uq4

5.登陆mysql并且修改密码

alter user 'root'@'localhost' identified by 'root123';

修改密码,会出现:

error 1819 (hy000): your password does not satisfy the current policy requirements

必须修改两个全局参数:

首先,修改validate_password_policy参数的值

set global validate_password_policy=0;

再修改密码的长度

set global validate_password_length=1;

再次执行修改密码就可以了

alter user 'root'@'localhost' identified by 'root123';

6.授权其他机器连接

grant all privileges on *.* to 'root'@'%' identified by 'passwort' with grant option; //passwort改为mysql登陆密码

flush privileges;

7.密码设置的详细说明


或者

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持移动技术网。

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网