centos7.3安装mysql5.5
时间: 2023-10-20 18:05:49 浏览: 90
centos7 安装mysql5.6
1. 安装MySQL 5.5的Yum Repository
```
sudo rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
```
2. 安装MySQL 5.5
```
sudo yum install mysql-server
```
3. 启动MySQL服务
```
sudo systemctl start mysqld
```
4. 设置MySQL服务开机自启动
```
sudo systemctl enable mysqld
```
5. 查看MySQL服务状态
```
sudo systemctl status mysqld
```
6. 修改MySQL root密码
```
sudo mysql_secure_installation
```
7. 登录MySQL
```
mysql -u root -p
```
8. 创建新用户并授权
```
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'newuser'@'localhost' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
```
9. 退出MySQL
```
exit
```
注:上述命令中的“newuser”和“password”需要替换为你自己的用户名和密码。
阅读全文