Ubuntu 安裝 MySQL 8.0 (mysql-community-server)

有鑑於 MySQL 8 的效能跟各方面的精進,還有安全上的保護,慢慢將手上的機器都換成 MySQL 8。

首先到 MySQL Community Downloads 挑選 MySQL APT Repository,然後下載 mysql-apt-config_0.8.16-1_all.deb,接下來安裝:

wget https://repo.mysql.com//mysql-apt-config_0.8.16-1_all.deb
dpkg -i mysql-apt-config_0.8.16-1_all.deb

然後更新 apt repository list

sudo apt update

安裝 mysql-community-client mysql-community-server

sudo apt install mysql-community-client mysql-community-server

察看安裝的版本

ubuntu@guestOS:~$ dpkg -l | grep mysql-community
ii  mysql-community-client           8.0.23-1ubuntu20.04                                                amd64        MySQL Client
ii  mysql-community-client-core      8.0.23-1ubuntu20.04                                                amd64        MySQL Client Core Binaries
ii  mysql-community-client-plugins   8.0.23-1ubuntu20.04                                                amd64        MySQL Client plugin
ii  mysql-community-server           8.0.23-1ubuntu20.04                                                amd64        MySQL Server
ii  mysql-community-server-core      8.0.23-1ubuntu20.04                                                amd64        MySQL Server Core Binaires

接下來編輯 /etc/mysqlmysql.conf.d/mysqld.cnf

sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf

於 [mysqld] 之下,新增下列參數,不知道什麼原因,安裝好之後,只會預設 listen 在 IPv6

bind-address    = 127.0.0.1

重新啟動 MySQL

sudo systemctl restart mysql.service

接下來開始 MySQL 的設定。

sudo mysql_secure_installation

發表迴響

回到頂端