环境:rhel 7.2
登录 https://dev.mysql.com/downloads/mysql/ 该网址下载以下rpm
mysql-community-client-5.7.19-1.el7.x86_64.rpm mysql-community-common-5.7.19-1.el7.x86_64.rpm mysql-community-devel-5.7.19-1.el7.x86_64.rpm mysql-community-libs-5.7.19-1.el7.x86_64.rpm mysql-community-server-5.7.19-1.el7.x86_64.rpm |
1、初始化
# systemctl disable firewalld
# hostnamectl set-hostname mysql-01
# bash
# vi /etc/selinux/config
SELINUX=disabled |
# systemctl disbale firewalld
# reboot
2、安装
# rpm -qa | egrep "mysql|maria"
# rpm -e mariadb-libs-5.5.44-2.el7.x86_64 --nodeps # 卸载旧的
# yum -y install net-tools perl
# cd /usr/local/src/
# rpm -ivh mysql-community-*
# systemctl enable mysqld
# systemctl start mysqld
3、配置与验证
# more /var/log/mysqld.log | grep pass # 查看初始密码
# mysql_secure_installation # 修改密码
# mysql -uroot -p # 验证
PS:命令行修改密码:
mysql> set password for'root'@'localhost'='newpassword';