1.配置yum仓库
#更新秘钥 rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2023
#安装MySQL rpm -Uvh http://dev.mysql.com/get/mysql80-community-release-el7-2.noarch.rpm
2.使用yum安装MySQL
yum -y install mysql-community-server
3.启动MySQL并配置开机自启动
systemctl start mysqld #启动
systemctl enable mysqld #开机自启
systemctl status mysqld #检查状态
3.配置root用户
获取root初始密码 grep "temporary password" /var/log/mysqld.log
登录mysql
mysql -uroot -p
修改root用户密码
alter user 'root'@'localhost' identified with mysql_native_password by '********';
配置远程连接并退出登录
create user 'root'@'%' identified with mysql_native_password by '********';