1.下载mysql的yum源 wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
2.安装yum源
yum localinstall mysql57-community-release-el7-8.noarch.rpm
3.检查是否安装成功yum repolist enabled | grep "mysql.*-community.*"
3.安装mysqlyum install mysql-community-server
4.启动服务
systemctl start mysqld
5.设置开机启动systemctl enable mysqld
systemctl daemon-reload
5.修改root密码
mysql安装完成之后,在/var/log/mysqld.log文件中给root生成了一个默认密码。通过下面的方式找到root默认密码,然后登录mysql进行修改:
5.1 grep 'temporary password' /var/log/mysqld.log
5.2 mysql -uroot -p
输入密码
5.3
先把5.7之后默认加的密码验证关闭
set global validate_password_policy=0;
set global validate_password_number_count=3;
set global validate_password_length=3;
setglobal validate_password_length=3;
set global validate_password_special_char_count=0;
SHOW VARIABLES LIKE 'validate_password%';
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
6.默认只允许本地连接,需要授权
grant all privileges on *.* to 'root' @'%' identified by '123456';
flush privileges;
7.默认配置文件
配置文件:/etc/my.cnf
服务启动脚本:/usr/lib/systemd/system/mysqld.service
socket文件:/var/run/mysqld/mysqld.pid
setglobal validate_password_length=3;
redhat6.8安装问题:
1.Error: Package: 2:postfix-2.6.6-8.el6.x86_64 (base)
yum update postfix
2.
Error: Package: mysql-community-server-5.7.30-1.el7.x86_64 (mysql57-community)
Error: Package: mysql-community-client-5.7.30-1.el7.x86_64 (mysql57-community)
Error: Package: mysql-community-client-5.7.30-1.el7.x86_64 (mysql57-community)
Error: Package: mysql-community-libs-5.7.30-1.el7.x86_64 (mysql57-community)
Error: Package: mysql-community-server-5.7.30-1.el7.x86_64 (mysql57-community)
Error: Package: mysql-community-libs-compat-5.7.30-1.el7.x86_64 (mysql57-community)
Error: Package: mysql-community-server-5.7.30-1.el7.x86_64 (mysql57-community)
Error: Package: mysql-community-server-5.7.30-1.el7.x86_64 (mysql57-community)
删除 yum remove mysql mysql-server mysql-libs mysql-server
检查 rpm -qa | grep -i mysql
3.PackageKit-0.5.8-26.el6.x86_64 has missing requires of PackageKit-yum = ('0', '0.5.8', '26.el6')
yum install -y PackageKit-yum
4.PackageKit-0.5.8-26.el6.x86_64 has missing requires of PackageKit-yum-plugin = ('0', '0.5.8', '26.el6')
yum install -y PackageKit-yum-plugin
5.rhn-check-1.0.0.1-38.el6.noarch has missing requires of yum-rhn-plugin >= ('0', '0.9.1', '35')
yum remove 'rhn-check-1.0.0.1-38.el6.noarch'