参考网址
#1.官网下载对应的文件并解压
tar -xf mysql-server_8.0.31-1ubuntu20.04_amd64.deb-bundle.tar
#2.下载所需的依赖
wget http://archive.ubuntu.com/ubuntu/pool/main/m/mecab/libmecab2_0.996-10build1_amd64.deb
#3.按照如下顺序安装
dpkg -i mysql-community-client-plugins_8
dpkg -i mysql-community-client-core_8
dpkg -i mysql-common_8
dpkg -i mysql-community-client_8
dpkg -i libmysqlclient2
dpkg -i libmysqlclient-dev_8
dpkg -i mysql-client_8
dpkg -i libmecab2
dpkg -i mysql-community-server-core_8
dpkg -i mysql-community-server_8
dpkg -i mysql-server_8.0
#1.安装完成后验证
root@kht:/kht# mysql -V
mysql Ver 8.0.31 for Linux on x86_64 (MySQL Community Server - GPL)
#查看mysql状态并启动
root@kht:/kht# systemctl status mysql
root@kht:/kht# systemctl start mysql
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor prese>
Active: active (running) since Mon 2022-11-14 19:04:47 CST; 1s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 31420 ExecStartPre=/usr/share/mysql-8.0/mysql-systemd-start pre >
Main PID: 31477 (mysqld)
Status: "Server is operational"
Tasks: 39 (limit: 4575)
Memory: 363.9M
CGroup: /system.slice/mysql.service
└─31477 /usr/sbin/mysqld
Nov 14 19:04:46 kht systemd[1]: Starting MySQL Community Server...
Nov 14 19:04:47 kht systemd[1]: Started MySQL Community Server.
#3.登录并进入
root@kht:/kht# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.