linux3 yum 安装mysql8
时间: 2024-02-21 17:54:56 浏览: 199
源码安装与yum安装mysql.docx
以下是使用yum安装MySQL 8的步骤:
1. 添加MySQL的yum源配置文件:
```shell
sudo vi /etc/yum.repos.d/mysql-community.repo
```
在文件中添加以下内容:
```shell
[mysql80-community]
name=MySQL 8.0 Community Server
baseurl=http://repo.mysql.com/yum/mysql-80-community/el/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=fileetc/pki/rpm-gpg/RPM-GPGKEY-mysql
```
2. 安装MySQL 8:
```shell
sudo yum install mysql-community-server
```
3. 启动MySQL服务:
```shell
sudo systemctl start mysqld
```
4. 查看初始密码:
```shell
sudo grep 'temporary password' /var/log/mysqld.log
```
5. 运行MySQL安全性脚本以提高安全性并设置新密码:
```shell
sudo mysql_secure_installation
```
6. 尝试连接MySQL:
```shell
mysql -u root -p
```
7. 输入初始密码,然后根据提示修改密码。
阅读全文