配置yum源
[root@iZ2ze9ridy7gp330brwunrZ /]# wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
[root@iZ2ze9ridy7gp330brwunrZ /]# yum localinstall mysql57-community-release-el7-8.noarch.rpm
检查是否配置成功- [root@iZ2ze9ridy7gp330brwunrZ /]# yum repolist enabled | grep “mysql.-community .”
安装
- [root@iZ2ze9ridy7gp330brwunrZ /]# yum install mysql-community-server
- [root@iZ2ze9ridy7gp330brwunrZ /]# systemctl start mysqld
- [root@iZ2ze9ridy7gp330brwunrZ /]# systemctl status mysqld
开机自启动
systemctl enable mysqld
systemctl daemon-reload
寻找默认密码
- [root@iZ2ze9ridy7gp330brwunrZ /]# grep ‘temporary password’ /var/log/mysqld.log
更改密码
- [root@iZ2ze9ridy7gp330brwunrZ /]# mysql -uroot -p
- mysql> set password for ‘root’@’localhost’=password(‘NewPwd4!@#’);
允许远程连接
- GRANT ALL PRIVILEGES ON . TO ‘root’@’%’ IDENTIFIED BY ‘your_root_password’
编码修改
- [root@iZ2ze9ridy7gp330brwunrZ /]# vim /etc/my.cnf
[mysqld]
character_set_server=utf8
init_connect=’SET NAMES utf8’