centos7.9安装mysql5.7
时间: 2023-04-13 21:01:37 浏览: 158
CentOS Linux release 7.9.2009 安装 mysql-5.7.37-linux-glibc2.12-x8
以下是CentOS 7.9安装MySQL 5.7的步骤:
1. 首先,更新系统并安装必要的软件包:
sudo yum update
sudo yum install wget
2. 下载MySQL 5.7的yum存储库:
wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
3. 安装yum存储库:
sudo rpm -ivh mysql57-community-release-el7-11.noarch.rpm
4. 安装MySQL 5.7:
sudo yum install mysql-community-server
5. 启动MySQL服务:
sudo systemctl start mysqld
6. 查看MySQL服务状态:
sudo systemctl status mysqld
7. 设置MySQL服务开机自启:
sudo systemctl enable mysqld
8. 查看MySQL默认密码:
sudo grep 'temporary password' /var/log/mysqld.log
9. 登录MySQL:
mysql -u root -p
10. 输入默认密码并修改密码:
ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';
11. 退出MySQL:
exit
现在,您已经成功安装了MySQL 5.7。
阅读全文