停止MySQL服务
systemctl stop mariadb.service
systemctl stop mysqld
禁止MySQL服务开机自启
systemctl disable mysqld
卸载MySQL软件包
yum remove mysql-server mysql-client
删除MySQL数据目录
rm -rf /var/lib/mysql
清理MySQL配置文件
rm -rf /etc/my.cnf
rpm -qa | grep mysql/mariadb
sudo rpm -e --nodeps mysql...
Index of /232905 (mysql.com)
选择合适的版本:mysql57-community-release-el7-9.noarch
查看当前yum源
ls /etc/yum.repos.d/ -al
安装MySQL官方yum源
rpm -ivh mysql57-community-release-el7-9.noarch.rpm
看看能不能正常⼯作
yum list | grep mysql
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
yum install -y mysql-community-server
ls /etc/my.cnf
which mysqld
which mysql
systemctl start mysqld.service
grep 'temporary password' /var/log/mysqld.log
mysql -u root -p
注意:新版本的MySQL没有临时密码,可以直接登录
vim /etc/my.cnf
在最后一行添加
skip-grant-tables
systemctl restart mysqld 重启服务
mysql -u root -p 直接回车即可登录
systemctl enable mysqld
systemctl daemon-reload
配置⼀下my.conf,主要是数据库客⼾端和服务器的编码格式
vim /etc/my.cnf
末尾添加以下两行
character-set-server=utf8
default-storage-engine=innodb