Ubuntu20.04安装MySQL 8.0.34全程记录

一、官网下载安装包准备安装

1.下载tar包MySQL :: Download MySQL Community Servericon-default.png?t=N7T8https://dev.mysql.com/downloads/mysql/Ubuntu20.04安装MySQL 8.0.34全程记录_第1张图片

 找到下载链接,我直接下载到用户文件夹下。

~$ wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-server_8.0.34-1ubuntu20.04_amd64.deb-bundle.tar

2.解压缩tar包

~$ tar xf mysql-server_8.0.34-1ubuntu20.04_amd64.deb-bundle.tar

3.为解压后的文件设置权限

解压完后的deb包如果是红色的文字,说明没有执行权限,需要添加执行权限

Ubuntu20.04安装MySQL 8.0.34全程记录_第2张图片

 输入命令

~$ sudo chmod +x mysql*

~$ sudo chmod +x libmysqlclient*

文字变黑

 Ubuntu20.04安装MySQL 8.0.34全程记录_第3张图片

二、开始安装(依次执行)

1.安装mysql-common包

~$ sudo dpkg -i mysql-common_8.0.34-1ubuntu20.04_amd64.deb

2.安装mysql-community-client-plugins包

~$ sudo dpkg -i mysql-community-client-plugins_8.0.34-1ubuntu20.04_amd64.deb

3.安装mysql-community-client-core包

~$ sudo  dpkg -i mysql-community-client-core_8.0.34-1ubuntu20.04_amd64.deb

4. 安装mysql-community-client包

~$ sudo dpkg -i mysql-community-client_8.0.34-1ubuntu20.04_amd64.deb

5.安装mysql-client包

~$ sudo dpkg -i mysql-client_8.0.34-1ubuntu20.04_amd64.deb

6.安装mysql-community-server-core和mysql-community-server包,若安装过程中提示缺少libaio1libmecab2包,可以先下载安装libaio1和libmecab2包

sudo apt-get install libaio1
sudo apt-get install libmecab2

再依次安装mysql-community-server-core和mysql-community-server包。

sudo dpkg -i mysql-community-server-core_8.0.34-1ubuntu20.04_amd64.deb
sudo dpkg -i mysql-community-server_8.0.34-1ubuntu20.04_amd64.deb

直接用sudo apt --fix-broken install修复安装libaio1和libmecab2包

~$ sudo apt --fix-broken install

使用该命令后,输入“y”,会同时安装mysql-community-server-core和mysql-community-server包

qs@qs-ubuntu:~$ sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  libmecab2
The following NEW packages will be installed:
  libmecab2
0 upgraded, 1 newly installed, 0 to remove and 3 not upgraded.
2 not fully installed or removed.
Need to get 0 B/233 kB of archives.
After this operation, 1,865 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Selecting previously unselected package libmecab2:amd64.
(Reading database ... 165162 files and directories currently installed.)
Preparing to unpack .../libmecab2_0.996-10build1_amd64.deb ...
Unpacking libmecab2:amd64 (0.996-10build1) ...
Setting up libmecab2:amd64 (0.996-10build1) ...
Setting up mysql-community-server-core (8.0.34-1ubuntu20.04) ...
Setting up mysql-community-server (8.0.34-1ubuntu20.04) ...
update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Created symlink /etc/systemd/system/multi-user.target.wants/mysql.service → /lib/systemd/system/mysql.service.
Processing triggers for libc-bin (2.31-0ubuntu9.12) ...

7.安装过程中弹出设置root密码界面,在输入框中设置root密码,这里忘记截图,按操作要求来即可。至此安装完成。

三、查看安装的MySQL版本,检测是否成功安装

1.查看版本

~$ mysql --version

2.登入mysql 

~$ mysql -uroot -p

Ubuntu20.04安装MySQL 8.0.34全程记录_第4张图片

安装成功。 

你可能感兴趣的:(mysql,数据库)