centos7 mysql 安装
时间: 2023-12-06 17:37:27 浏览: 87
以下是在CentOS 7上安装MySQL的步骤:
1.下载MySQL社区版的Yum Repository包:
```shell
wget https://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
```
2.安装Yum Repository包:
```shell
sudo rpm -ivh mysql57-community-release-el7-8.noarch.rpm
```
3.检查系统是否已经安装了MySQL:
```shell
rpm -qa | grep -i mysql
```
4.安装MySQL服务器:
```shell
sudo yum install mysql-server
```
5.启动MySQL服务:
```shell
sudo systemctl start mysqld
```
6.检查MySQL服务是否已经启动:
```shell
sudo systemctl status mysqld
```
7.设置MySQL服务开机自启动:
```shell
sudo systemctl enable mysqld
```
8.运行MySQL安全脚本,设置root用户密码:
```shell
sudo mysql_secure_installation
```
9.按照提示输入root用户密码,然后根据需要设置密码强度和其他选项。
阅读全文