MySQL
跳到导航
跳到搜索
MySQL Community Server
https://downloads.mysql.com/archives/community/
卸载MariaDB
rpm -qa | grep -i mariadb
rpm -e mariadb-libs-5.5.68-1.el7.x86_64 --nodeps
创建目录、解压
mkdir mysql
tar -xvf mysql-8.0.26-1.el7.x86_64.rpm-bundle.tar -C mysql
安装MySQL
cd mysql
rpm -ivh mysql-community-common-8.0.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-plugins-8.0.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-8.0.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-compat-8.0.26-1.el7.x86_64.rpm
yum install openssl-devel
rpm -ivh mysql-community-devel-8.0.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-8.0.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-8.0.26-1.el7.x86_64.rpm
启动MySQL服务
systemctl start mysqld
查询自动生成的root用户密码
grep 'temporary password' /var/log/mysqld.log
mysql -u root -p
修改root用户密码
set global validate_password.policy = 0; set global validate_password.length = 8;
ALTER USER 'root'@'localhost' IDENTIFIED BY 'password';
创建用户
CREATE USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'password';
授予权限
GRANT ALL ON *.* TO 'root'@'%';
重新连接MySQL
mysql -u root -p