升级,建议完成后重启
yum -y update
卸载已安装的Mysql
yum -y remove mysql-libs
安装依赖
yum -y install numactl-libs
下载安装包
wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-community-common-5.7.19-1.el7.x86_64.rpm wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-community-libs-5.7.19-1.el7.x86_64.rpm wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-community-libs-compat-5.7.19-1.el7.x86_64.rpm wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-community-client-5.7.19-1.el7.x86_64.rpm wget https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-community-server-5.7.19-1.el7.x86_64.rpm
安装
rpm -ivh mysql-community-common-5.7.19-1.el7.x86_64.rpm --nosignature rpm -ivh mysql-community-libs-5.7.19-1.el7.x86_64.rpm --nosignature rpm -ivh mysql-community-libs-compat-5.7.19-1.el7.x86_64.rpm --nosignature rpm -ivh mysql-community-client-5.7.19-1.el7.x86_64.rpm --nosignature rpm -ivh mysql-community-server-5.7.19-1.el7.x86_64.rpm --nosignature
启动
service mysqld start
查看初始密码
grep "password" /var/log/mysqld.log
登录mysql后立即修改密码
SET PASSWORD FOR ‘root‘@‘localhost‘ = PASSWORD(‘newpass‘);
此处可能提示密码不符合要求,输入下列语句后重新修改密码即可
set global validate_password_policy=0;
设置开机自启
chkconfig mysqld on
修改mysql配置
vim /etc/my.cnf
修改为
[client] port=3306 default-character-set=utf8mb4 [mysqld] port=3306 character-set-client-handshake=0 character_set_server=utf8mb4 collation-server=utf8mb4_unicode_ci datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock symbolic-links=0 log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid
时间: 2024-11-14 09:24:27