centos安装mysql5.6
时间: 2023-09-14 18:11:45 浏览: 118
centos 7.0上安装mysql
以下是在CentOS 7中安装MySQL 5.6的步骤:
1. 添加MySQL Yum Repository
```bash
sudo rpm -Uvh https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
```
2. 安装MySQL 5.6
```bash
sudo yum install mysql-community-server-5.6
```
3. 启动MySQL服务
```bash
sudo systemctl start mysqld
```
4. 设置MySQL开机自启
```bash
sudo systemctl enable mysqld
```
5. 查看MySQL初始密码
```bash
sudo grep 'temporary password' /var/log/mysqld.log
```
6. 登录MySQL
```bash
mysql -u root -p
```
7. 修改MySQL初始密码
```mysql
ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';
```
8. 退出MySQL
```mysql
EXIT;
```
现在,您已经成功安装MySQL 5.6并设置了密码。
阅读全文