🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
1、下载mysql ``` wget http://repo.mysql.com/mysql57-community-release-el7-10.noarch.rpm ``` 2、安装mysql ``` rpm -Uvh mysql57-community-release-el7-10.noarch.rpm yum install -y mysql-community-server ``` 如果报以下错误: ``` Failing package is: mysql-community-server-5.7.40-1.el7.x86_64 GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql // 执行 rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022 // 再重新安装 ``` 3、启动msyql ``` systemctl start mysqld.service ``` 4、修改root密码 ``` // 获取临时密码 grep 'temporary password' /var/log/mysqld.log // 使用临时密码登录mysql mysql -uroot -p // 设置密码复杂度 mysql> set global validate_password_policy=0; mysql> set global validate_password_length=1; // 设置密码 ALTER USER 'root'@'localhost' IDENTIFIED BY '123456'; // 授权远程登录 GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION; FLUSH PRIVILEGES; ``` 5、卸载mysql ``` rpm -qa | grep mysql yum -y remove mysql57-community-release-el7-10.noarch ```