ubuntu安装MySQL8
时间: 2023-11-28 13:44:19 浏览: 54
ubuntu 一键安装mysql8
在Ubuntu 18.04中安装MySQL 8的步骤如下:
1.添加MySQL APT存储库
```shell
wget -c https://dev.mysql.com/get/mysql-apt-config_0.8.13-1_all.deb
sudo dpkg -i mysql-apt-config_0.8.13-1_all.deb
```
2.安装MySQL
```shell
sudo apt update
sudo apt install mysql-server
```
3.启动MySQL服务
```shell
sudo systemctl start mysql
```
4.检查MySQL服务状态
```shell
sudo systemctl status mysql
```
如果MySQL服务正在运行,则输出应该类似于以下内容:
```shell
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2021-08-23 14:22:22 UTC; 1min 30s ago
Main PID: 1234 (mysqld)
Tasks: 27 (limit: 1152)
CGroup: /system.slice/mysql.service
└─1234 /usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid
```
5.配置MySQL
```shell
sudo mysql_secure_installation
```
6.登录MySQL
```shell
sudo mysql -u root -p
```
阅读全文