linux centos 安装mysql8
时间: 2023-12-12 20:35:23 浏览: 119
以下是在Linux CentOS 7上安装MySQL 8的步骤:
1.添加MySQL Yum Repository
```shell
sudo rpm -Uvh https://repo.mysql.com/mysql80-community-release-el7-3.noarch.rpm
```
2.安装MySQL Server
```shell
sudo yum install mysql-server
```
3.启动MySQL服务
```shell
sudo systemctl start mysqld
```
4.检查MySQL服务状态
```shell
sudo systemctl status mysqld
```
5.设置MySQL开机自启
```shell
sudo systemctl enable mysqld
```
6.设置MySQL大小写不敏感
```shell
sudo vim /etc/my.cnf
```
在[mysqld]下添加以下内容:
```shell
lower_case_table_names=1
```
7.重启MySQL服务
```shell
sudo systemctl restart mysqld
```
8.登录MySQL
```shell
sudo mysql -u root -p
```
以上是在Linux CentOS 7上安装MySQL 8的步骤。
相关问题
linux中centos8安装mysql
可以通过以下步骤在CentOS 8中安装MySQL:
1.打开终端并以root用户身份登录。
2.使用以下命令更新系统:yum update
3.安装MySQL存储库:yum install https://dev.mysql.com/get/mysql80-community-release-el8-1.noarch.rpm
4.安装MySQL服务器:yum install mysql-community-server
5.启动MySQL服务并将其设置为开机启动:systemctl start mysqld && systemctl enable mysqld
6.使用以下命令检查MySQL是否已成功安装:systemctl status mysqld
请注意,在此过程中,您可能需要输入MySQL存储库的密码。
linux centos7安装mysql8.0.36
在CentOS 7上安装MySQL 8.0.36的步骤如下:
1. 更新系统:
```
sudo yum update
```
2. 添加MySQL Yum Repository:
```
sudo rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
```
3. 安装MySQL Server:
```
sudo yum install mysql-server
```
4. 启动MySQL服务:
```
sudo systemctl startqld
```
5. 运行安全性脚本,设置root密码等:
```
sudo mysql_secure_installation
```
6. 登录MySQL:
```
sudo mysql -u root -p
```
7. 创建新用户并授权:
```
CREATE USER 'new_user'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'new_user'@'localhost';
FLUSH PRIVILEGES;
```
8. 退出MySQL:
```
exit
```
以上是在CentOS 7上安装MySQL 8.0.36的基本步骤。
阅读全文