在 Ubuntu 18.04 中安装 MySQL 8

在 Ubuntu 18.04 中安装 MySQL 8

须知:以下出现的命令,以 # 开头,由 root 用户执行;以 $ 开头,由普通用户执行;命令后面的 // 代表注释。

环境信息

Ubuntu 系统信息:

# lsb_release --all
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.3 LTS
Release:	18.04
Codename:	bionic

添加 MySQL APT 仓库

下载 MySQL APT Repository,然后将其添加到系统软件仓库列表:

$ sudo dpkg --install /home//mk/Downloads/mysql-apt-config_0.8.14-1_all.deb
Selecting previously unselected package mysql-apt-config.
(Reading database ... 168087 files and directories currently installed.)
Preparing to unpack .../mysql-apt-config_0.8.14-1_all.deb ...
Unpacking mysql-apt-config (0.8.14-1) ...
Setting up mysql-apt-config (0.8.14-1) ...

在这里插入图片描述
根据自己的需要配置,确认之后选择 OK,提示:

Warning: apt-key should not be used in scripts (called from postinst maintainerscript of the package mysql-apt-config)
OK

从 MySQL APT 仓库更新包信息:

$ sudo apt-get update
Hit:1 http://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic InRelease   
Get:2 http://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-security InRelease [88.7 kB]
Get:3 http://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-updates InRelease [88.7 kB]
Get:4 http://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-backports InRelease [74.6 kB]
Get:5 http://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-proposed InRelease [242 kB]
Get:6 http://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-security/main amd64 DEP-11 Metadata [38.5 kB]
Get:7 http://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-security/main DEP-11 48x48 Icons [17.6 kB]
Get:8 http://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-security/main DEP-11 64x64 Icons [41.5 kB]
Get:9 http://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-security/universe amd64 DEP-11 Metadata [42.1 kB]
Get:10 http://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-security/universe DEP-11 48x48 Icons [16.4 kB]
Get:11 http://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-security/universe DEP-11 64x64 Icons [111 kB]
Get:12 http://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-security/multiverse amd64 DEP-11 Metadata [2,464 B]
Get:13 http://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-updates/main amd64 DEP-11 Metadata [294 kB]
Get:14 http://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-updates/main DEP-11 48x48 Icons [73.8 kB]
Get:15 http://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-updates/main DEP-11 64x64 Icons [140 kB]
Get:16 http://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-updates/universe amd64 DEP-11 Metadata [264 kB]
Get:17 http://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-updates/universe DEP-11 48x48 Icons [197 kB]
Get:18 http://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-updates/universe DEP-11 64x64 Icons [445 kB]
Get:19 http://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-updates/multiverse amd64 DEP-11 Metadata [2,464 B]
Get:20 http://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-backports/universe amd64 DEP-11 Metadata [8,280 B]
Get:21 http://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-proposed/main amd64 DEP-11 Metadata [20.4 kB]
Get:22 http://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-proposed/main DEP-11 64x64 Icons [11.0 kB]
Get:23 http://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-proposed/universe amd64 DEP-11 Metadata [11.7 kB]
Hit:24 http://mirrors.aliyun.com/ubuntu bionic InRelease                       
Get:25 http://mirrors.aliyun.com/ubuntu bionic-security InRelease [88.7 kB]    
Get:26 http://mirrors.aliyun.com/ubuntu bionic-updates InRelease [88.7 kB]     
Get:27 http://mirrors.aliyun.com/ubuntu bionic-backports InRelease [74.6 kB]   
Get:28 http://mirrors.aliyun.com/ubuntu bionic-proposed InRelease [242 kB]     
Get:29 http://mirrors.aliyun.com/ubuntu bionic-security/main amd64 DEP-11 Metadata [38.5 kB]
Get:30 http://mirrors.aliyun.com/ubuntu bionic-security/main DEP-11 48x48 Icons [17.6 kB]
Get:31 http://mirrors.aliyun.com/ubuntu bionic-security/main DEP-11 64x64 Icons [41.5 kB]
Get:32 http://mirrors.aliyun.com/ubuntu bionic-security/universe amd64 DEP-11 Metadata [42.1 kB]
Get:33 http://mirrors.aliyun.com/ubuntu bionic-security/universe DEP-11 48x48 Icons [16.4 kB]
Get:34 http://mirrors.aliyun.com/ubuntu bionic-security/universe DEP-11 64x64 Icons [111 kB]
Get:35 http://mirrors.aliyun.com/ubuntu bionic-security/multiverse amd64 DEP-11 Metadata [2,464 B]
Get:36 http://mirrors.aliyun.com/ubuntu bionic-updates/main amd64 DEP-11 Metadata [294 kB]
Get:37 http://mirrors.aliyun.com/ubuntu bionic-updates/main DEP-11 48x48 Icons [73.8 kB]
Get:38 http://mirrors.aliyun.com/ubuntu bionic-updates/main DEP-11 64x64 Icons [140 kB]
Get:39 http://mirrors.aliyun.com/ubuntu bionic-updates/universe amd64 DEP-11 Metadata [264 kB]
Get:40 http://mirrors.aliyun.com/ubuntu bionic-updates/universe DEP-11 48x48 Icons [208 kB]
Get:41 http://mirrors.aliyun.com/ubuntu bionic-updates/universe DEP-11 64x64 Icons [456 kB]
Get:42 http://mirrors.aliyun.com/ubuntu bionic-updates/multiverse amd64 DEP-11 Metadata [2,464 B]
Get:43 http://mirrors.aliyun.com/ubuntu bionic-backports/universe amd64 DEP-11 Metadata [8,284 B]
Get:44 http://mirrors.aliyun.com/ubuntu bionic-proposed/main amd64 DEP-11 Metadata [20.5 kB]
Get:45 http://mirrors.aliyun.com/ubuntu bionic-proposed/universe amd64 DEP-11 Metadata [11.7 kB]
Get:46 http://mirrors.aliyun.com/ubuntu bionic-proposed/universe DEP-11 64x64 Icons [10.8 kB]
Get:47 http://repo.mysql.com/apt/ubuntu bionic InRelease [19.4 kB]                                  
Get:47 http://repo.mysql.com/apt/ubuntu bionic InRelease [19.4 kB]                                  
Get:48 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 Sources [948 B]
Get:49 http://repo.mysql.com/apt/ubuntu bionic/mysql-apt-config amd64 Packages [566 B]
Get:50 http://repo.mysql.com/apt/ubuntu bionic/mysql-apt-config i386 Packages [566 B]
Get:51 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 Packages [7,570 B]
Get:52 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 i386 Packages [7,620 B]                    
Get:53 http://repo.mysql.com/apt/ubuntu bionic/mysql-tools amd64 Packages [4,294 B]                 
Get:54 http://repo.mysql.com/apt/ubuntu bionic/mysql-tools i386 Packages [3,694 B]                  
Fetched 4,519 kB in 53s (84.8 kB/s)                                                                 
Reading package lists... Done

使用 APT 安装 MySQL

安装 MySQL:

$ sudo apt-get install mysql-server
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libmecab2 mecab-ipadic mecab-ipadic-utf8 mecab-utils mysql-client mysql-common
  mysql-community-client mysql-community-client-core mysql-community-server
  mysql-community-server-core
The following NEW packages will be installed:
  libmecab2 mecab-ipadic mecab-ipadic-utf8 mecab-utils mysql-client mysql-community-client
  mysql-community-client-core mysql-community-server mysql-community-server-core mysql-server
The following packages will be upgraded:
  mysql-common
1 upgraded, 10 newly installed, 0 to remove and 95 not upgraded.
Need to get 35.3 MB of archives.
After this operation, 255 MB of additional disk space will be used.
Do you want to continue? [Y/n] 

输入 y 继续:

Do you want to continue? [Y/n] y
Get:1 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-common amd64 8.0.19-1ubuntu18.04 [94.6 kB]
Get:2 http://mirrors.aliyun.com/ubuntu bionic/universe amd64 libmecab2 amd64 0.996-5 [257 kB]       
Get:3 http://mirrors.aliyun.com/ubuntu bionic/universe amd64 mecab-utils amd64 0.996-5 [4,856 B]    
Get:4 http://mirrors.aliyun.com/ubuntu bionic/universe amd64 mecab-ipadic all 2.7.0-20070801+main-1 [12.1 MB]
Get:5 http://mirrors.aliyun.com/ubuntu bionic/universe amd64 mecab-ipadic-utf8 all 2.7.0-20070801+main-1 [3,522 B]
Get:6 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-community-client-core amd64 8.0.19-1ubuntu18.04 [1,684 kB]
Get:7 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-community-client amd64 8.0.19-1ubuntu18.04 [2,825 kB]
Get:7 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-community-client amd64 8.0.19-1ubuntu18.04 [2,825 kB]
Get:7 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-community-client amd64 8.0.19-1ubuntu18.04 [2,825 kB]
Get:7 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-community-client amd64 8.0.19-1ubuntu18.04 [2,825 kB]
Get:7 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-community-client amd64 8.0.19-1ubuntu18.04 [2,825 kB]
Get:7 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-community-client amd64 8.0.19-1ubuntu18.04 [2,825 kB]
Get:7 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-community-client amd64 8.0.19-1ubuntu18.04 [2,825 kB]
Get:7 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-community-client amd64 8.0.19-1ubuntu18.04 [2,825 kB]
Get:7 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-community-client amd64 8.0.19-1ubuntu18.04 [2,825 kB]
Get:7 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-community-client amd64 8.0.19-1ubuntu18.04 [2,825 kB]
Get:7 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-community-client amd64 8.0.19-1ubuntu18.04 [2,825 kB]
Get:7 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-community-client amd64 8.0.19-1ubuntu18.04 [2,825 kB]
Get:7 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-community-client amd64 8.0.19-1ubuntu18.04 [2,825 kB]
Get:7 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-community-client amd64 8.0.19-1ubuntu18.04 [2,825 kB]
Get:7 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-community-client amd64 8.0.19-1ubuntu18.04 [2,825 kB]
Get:7 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-community-client amd64 8.0.19-1ubuntu18.04 [2,825 kB]
Get:7 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-community-client amd64 8.0.19-1ubuntu18.04 [2,825 kB]
Get:7 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-community-client amd64 8.0.19-1ubuntu18.04 [2,825 kB]
Get:7 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-community-client amd64 8.0.19-1ubuntu18.04 [2,825 kB]
Get:7 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-community-client amd64 8.0.19-1ubuntu18.04 [2,825 kB]
Get:7 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-community-client amd64 8.0.19-1ubuntu18.04 [2,825 kB]
Get:7 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-community-client amd64 8.0.19-1ubuntu18.04 [2,825 kB]
Get:8 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-client amd64 8.0.19-1ubuntu18.04 [91.1 kB]
Get:9 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-community-server-core amd64 8.0.19-1ubuntu18.04 [18.0 MB]
Get:9 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-community-server-core amd64 8.0.19-1ubuntu18.04 [18.0 MB]
Get:9 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-community-server-core amd64 8.0.19-1ubuntu18.04 [18.0 MB]
Get:9 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-community-server-core amd64 8.0.19-1ubuntu18.04 [18.0 MB]
Get:9 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-community-server-core amd64 8.0.19-1ubuntu18.04 [18.0 MB]
Get:9 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-community-server-core amd64 8.0.19-1ubuntu18.04 [18.0 MB]
Get:9 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-community-server-core amd64 8.0.19-1ubuntu18.04 [18.0 MB]
Get:9 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-community-server-core amd64 8.0.19-1ubuntu18.04 [18.0 MB]
Get:9 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-community-server-core amd64 8.0.19-1ubuntu18.04 [18.0 MB]
Get:9 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-community-server-core amd64 8.0.19-1ubuntu18.04 [18.0 MB]
Get:9 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-community-server-core amd64 8.0.19-1ubuntu18.04 [18.0 MB]
Get:9 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-community-server-core amd64 8.0.19-1ubuntu18.04 [18.0 MB]
Err:9 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-community-server-core amd64 8.0.19-1ubuntu18.04
  Connection failed [IP: 2.22.77.13 80]
Get:10 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-community-server amd64 8.0.19-1ubuntu18.04 [102 kB]
Get:10 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-community-server amd64 8.0.19-1ubuntu18.04 [102 kB]
Get:11 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-server amd64 8.0.19-1ubuntu18.04 [91.1 kB]
Get:11 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-server amd64 8.0.19-1ubuntu18.04 [91.1 kB]
Fetched 14.5 MB in 1h 2min 41s (3,855 B/s)                                     
E: Failed to fetch http://repo.mysql.com/apt/ubuntu/pool/mysql-8.0/m/mysql-community/mysql-community-server-core_8.0.19-1ubuntu18.04_amd64.deb  Connection failed [IP: 2.22.77.13 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

安装失败,按照提示,重新更新一次:

$ sudo apt-get update 
Hit:1 http://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic InRelease
Hit:2 http://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-security InRelease                          
Hit:3 http://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-updates InRelease                           
Hit:4 http://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-backports InRelease                         
Hit:5 http://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-proposed InRelease                          
Hit:6 http://repo.mysql.com/apt/ubuntu bionic InRelease                                       
Hit:7 http://mirrors.aliyun.com/ubuntu bionic InRelease             
Hit:8 http://mirrors.aliyun.com/ubuntu bionic-security InRelease                
Hit:9 http://mirrors.aliyun.com/ubuntu bionic-updates InRelease                 
Hit:10 http://mirrors.aliyun.com/ubuntu bionic-backports InRelease               
Hit:11 http://mirrors.aliyun.com/ubuntu bionic-proposed InRelease
Reading package lists... Done

再次执行安装:

$ sudo apt-get install mysql-server
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libmecab2 mecab-ipadic mecab-ipadic-utf8 mecab-utils mysql-client mysql-common
  mysql-community-client mysql-community-client-core mysql-community-server
  mysql-community-server-core
The following NEW packages will be installed:
  libmecab2 mecab-ipadic mecab-ipadic-utf8 mecab-utils mysql-client mysql-community-client
  mysql-community-client-core mysql-community-server mysql-community-server-core mysql-server
The following packages will be upgraded:
  mysql-common
1 upgraded, 10 newly installed, 0 to remove and 95 not upgraded.
Need to get 18.0 MB/35.3 MB of archives.
After this operation, 255 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://repo.mysql.com/apt/ubuntu bionic/mysql-8.0 amd64 mysql-community-server-core amd64 8.0.19-1ubuntu18.04 [18.0 MB]
81% [1 mysql-community-server-core 10.4 MB/18.0 MB 57%]                                                                                                         Fetched 16.8 MB in 1min 47s (157 kB/s)

输入密码:
在这里插入图片描述
确认密码:
在这里插入图片描述
提示:
在这里插入图片描述在这里插入图片描述
选择兼容 5.x 的认证插件:
在这里插入图片描述

Preconfiguring packages ...
(Reading database ... 168092 files and directories currently installed.)
Preparing to unpack .../00-mysql-common_8.0.19-1ubuntu18.04_amd64.deb ...
Unpacking mysql-common (8.0.19-1ubuntu18.04) over (5.8+1.0.4) ...
Selecting previously unselected package mysql-community-client-core.
Preparing to unpack .../01-mysql-community-client-core_8.0.19-1ubuntu18.04_amd64.deb ...
Unpacking mysql-community-client-core (8.0.19-1ubuntu18.04) ...
Selecting previously unselected package mysql-community-client.
Preparing to unpack .../02-mysql-community-client_8.0.19-1ubuntu18.04_amd64.deb ...
Unpacking mysql-community-client (8.0.19-1ubuntu18.04) ...
Selecting previously unselected package mysql-client.
Preparing to unpack .../03-mysql-client_8.0.19-1ubuntu18.04_amd64.deb ...
Unpacking mysql-client (8.0.19-1ubuntu18.04) ...
Selecting previously unselected package libmecab2:amd64.
Preparing to unpack .../04-libmecab2_0.996-5_amd64.deb ...
Unpacking libmecab2:amd64 (0.996-5) ...
Selecting previously unselected package mysql-community-server-core.
Preparing to unpack .../05-mysql-community-server-core_8.0.19-1ubuntu18.04_amd64.deb ...
Unpacking mysql-community-server-core (8.0.19-1ubuntu18.04) ...
Selecting previously unselected package mysql-community-server.
Preparing to unpack .../06-mysql-community-server_8.0.19-1ubuntu18.04_amd64.deb ...
Unpacking mysql-community-server (8.0.19-1ubuntu18.04) ...
Selecting previously unselected package mecab-utils.
Preparing to unpack .../07-mecab-utils_0.996-5_amd64.deb ...
Unpacking mecab-utils (0.996-5) ...
Selecting previously unselected package mecab-ipadic.
Preparing to unpack .../08-mecab-ipadic_2.7.0-20070801+main-1_all.deb ...
Unpacking mecab-ipadic (2.7.0-20070801+main-1) ...
Selecting previously unselected package mecab-ipadic-utf8.
Preparing to unpack .../09-mecab-ipadic-utf8_2.7.0-20070801+main-1_all.deb ...
Unpacking mecab-ipadic-utf8 (2.7.0-20070801+main-1) ...
Selecting previously unselected package mysql-server.
Preparing to unpack .../10-mysql-server_8.0.19-1ubuntu18.04_amd64.deb ...
Unpacking mysql-server (8.0.19-1ubuntu18.04) ...
Setting up mysql-common (8.0.19-1ubuntu18.04) ...

Configuration file '/etc/mysql/conf.d/mysql.cnf'
 ==> Deleted (by you or by a script) since installation.
 ==> Package distributor has shipped an updated version.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
 The default action is to keep your current version.
*** mysql.cnf (Y/I/N/O/D/Z) [default=N] ? 

输入 Y 继续:

*** mysql.cnf (Y/I/N/O/D/Z) [default=N] ? Y
Installing new version of config file /etc/mysql/conf.d/mysql.cnf ...

Configuration file '/etc/mysql/my.cnf.fallback'
 ==> Deleted (by you or by a script) since installation.
 ==> Package distributor has shipped an updated version.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
 The default action is to keep your current version.
*** my.cnf.fallback (Y/I/N/O/D/Z) [default=N] ? 

输入 Y 继续:

*** my.cnf.fallback (Y/I/N/O/D/Z) [default=N] ? Y
Installing new version of config file /etc/mysql/my.cnf.fallback ...
update-alternatives: warning: forcing reinstallation of alternative /etc/mysql/my.cnf.fallback because link group my.cnf is broken
Setting up libmecab2:amd64 (0.996-5) ...
Setting up mysql-community-client-core (8.0.19-1ubuntu18.04) ...
Setting up mysql-community-server-core (8.0.19-1ubuntu18.04) ...
Setting up mecab-utils (0.996-5) ...
Setting up mysql-community-client (8.0.19-1ubuntu18.04) ...
Setting up mecab-ipadic (2.7.0-20070801+main-1) ...
Compiling IPA dictionary for Mecab.  This takes long time...
reading /usr/share/mecab/dic/ipadic/unk.def ... 40
emitting double-array: 100% |###########################################| 
/usr/share/mecab/dic/ipadic/model.def is not found. skipped.
reading /usr/share/mecab/dic/ipadic/Noun.name.csv ... 34202
reading /usr/share/mecab/dic/ipadic/Noun.adverbal.csv ... 795
reading /usr/share/mecab/dic/ipadic/Adverb.csv ... 3032
reading /usr/share/mecab/dic/ipadic/Prefix.csv ... 221
reading /usr/share/mecab/dic/ipadic/Noun.csv ... 60477
reading /usr/share/mecab/dic/ipadic/Auxil.csv ... 199
reading /usr/share/mecab/dic/ipadic/Verb.csv ... 130750
reading /usr/share/mecab/dic/ipadic/Noun.others.csv ... 151
reading /usr/share/mecab/dic/ipadic/Suffix.csv ... 1393
reading /usr/share/mecab/dic/ipadic/Postp.csv ... 146
reading /usr/share/mecab/dic/ipadic/Postp-col.csv ... 91
reading /usr/share/mecab/dic/ipadic/Symbol.csv ... 208
reading /usr/share/mecab/dic/ipadic/Noun.verbal.csv ... 12146
reading /usr/share/mecab/dic/ipadic/Filler.csv ... 19
reading /usr/share/mecab/dic/ipadic/Conjunction.csv ... 171
reading /usr/share/mecab/dic/ipadic/Noun.number.csv ... 42
reading /usr/share/mecab/dic/ipadic/Adnominal.csv ... 135
reading /usr/share/mecab/dic/ipadic/Noun.nai.csv ... 42
reading /usr/share/mecab/dic/ipadic/Noun.demonst.csv ... 120
reading /usr/share/mecab/dic/ipadic/Interjection.csv ... 252
reading /usr/share/mecab/dic/ipadic/Noun.place.csv ... 72999
reading /usr/share/mecab/dic/ipadic/Others.csv ... 2
reading /usr/share/mecab/dic/ipadic/Adj.csv ... 27210
reading /usr/share/mecab/dic/ipadic/Noun.adjv.csv ... 3328
reading /usr/share/mecab/dic/ipadic/Noun.proper.csv ... 27327
reading /usr/share/mecab/dic/ipadic/Noun.org.csv ... 16668
emitting double-array: 100% |###########################################| 
reading /usr/share/mecab/dic/ipadic/matrix.def ... 1316x1316
emitting matrix      : 100% |###########################################| 

done!
update-alternatives: using /var/lib/mecab/dic/ipadic to provide /var/lib/mecab/dic/debian (mecab-dictionary) in auto mode
Setting up mysql-client (8.0.19-1ubuntu18.04) ...
Setting up mecab-ipadic-utf8 (2.7.0-20070801+main-1) ...
Compiling IPA dictionary for Mecab.  This takes long time...
reading /usr/share/mecab/dic/ipadic/unk.def ... 40
emitting double-array: 100% |###########################################| 
/usr/share/mecab/dic/ipadic/model.def is not found. skipped.
reading /usr/share/mecab/dic/ipadic/Noun.name.csv ... 34202
reading /usr/share/mecab/dic/ipadic/Noun.adverbal.csv ... 795
reading /usr/share/mecab/dic/ipadic/Adverb.csv ... 3032
reading /usr/share/mecab/dic/ipadic/Prefix.csv ... 221
reading /usr/share/mecab/dic/ipadic/Noun.csv ... 60477
reading /usr/share/mecab/dic/ipadic/Auxil.csv ... 199
reading /usr/share/mecab/dic/ipadic/Verb.csv ... 130750
reading /usr/share/mecab/dic/ipadic/Noun.others.csv ... 151
reading /usr/share/mecab/dic/ipadic/Suffix.csv ... 1393
reading /usr/share/mecab/dic/ipadic/Postp.csv ... 146
reading /usr/share/mecab/dic/ipadic/Postp-col.csv ... 91
reading /usr/share/mecab/dic/ipadic/Symbol.csv ... 208
reading /usr/share/mecab/dic/ipadic/Noun.verbal.csv ... 12146
reading /usr/share/mecab/dic/ipadic/Filler.csv ... 19
reading /usr/share/mecab/dic/ipadic/Conjunction.csv ... 171
reading /usr/share/mecab/dic/ipadic/Noun.number.csv ... 42
reading /usr/share/mecab/dic/ipadic/Adnominal.csv ... 135
reading /usr/share/mecab/dic/ipadic/Noun.nai.csv ... 42
reading /usr/share/mecab/dic/ipadic/Noun.demonst.csv ... 120
reading /usr/share/mecab/dic/ipadic/Interjection.csv ... 252
reading /usr/share/mecab/dic/ipadic/Noun.place.csv ... 72999
reading /usr/share/mecab/dic/ipadic/Others.csv ... 2
reading /usr/share/mecab/dic/ipadic/Adj.csv ... 27210
reading /usr/share/mecab/dic/ipadic/Noun.adjv.csv ... 3328
reading /usr/share/mecab/dic/ipadic/Noun.proper.csv ... 27327
reading /usr/share/mecab/dic/ipadic/Noun.org.csv ... 16668
emitting double-array: 100% |###########################################| 
reading /usr/share/mecab/dic/ipadic/matrix.def ... 1316x1316
emitting matrix      : 100% |###########################################|

done!
update-alternatives: using /var/lib/mecab/dic/ipadic-utf8 to provide /var/lib/mecab/dic/debian (mecab-dictionary) in auto mode
Setting up mysql-community-server (8.0.19-1ubuntu18.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.
Setting up mysql-server (8.0.19-1ubuntu18.04) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...

启动、停止 MySQL 服务器

MySQL 服务器在安装完成之后自动启动,我们可以查看 MySQL 服务器的状态:

$ sudo service mysql status
[sudo] password for mk: 
● mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: en
   Active: active (running) since Mon 2020-02-10 15:36:29 CST; 3min 48s ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 9376 ExecStartPre=/usr/share/mysql-8.0/mysql-systemd-start pre (code=
 Main PID: 9415 (mysqld)
   Status: "Server is operational"
    Tasks: 38 (limit: 4915)
   CGroup: /system.slice/mysql.service
           └─9415 /usr/sbin/mysqld

2月 10 15:36:26 mk-Lenovo-Y430P systemd[1]: Starting MySQL Community Server...
2月 10 15:36:29 mk-Lenovo-Y430P systemd[1]: Started MySQL Community Server.

通过以下命令停止 MySQL 服务器:

$ sudo service mysql stop

通过以下命令启动 MySQL 服务器:

$ sudo service mysql start

查看版本信息:

$ mysql --version
mysql  Ver 8.0.19 for Linux on x86_64 (MySQL Community Server - GPL)

在本机连接 MySQL 服务器:

$ mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.19 MySQL Community Server - GPL

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

参考

Ubuntu 18 安装MySQL8.0

Ubuntu18.04 安装MySQL8.0

Steps for a Fresh Installation of MySQL

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值