如何在Debian 9 Linux上安装MySQL社区版服务器

获取存储库配置

转到 https://dev.mysql.com/downloads/repo/apt/并下载最新的MySQL APT存储库包。
例子:

$wget https://dev.mysql.com/get/mysql-apt-config_0.8.6-1_all.deb
$ls
mysql-apt-config_0.8.6-1_all.deb

安装存储库配置

使用“gdebi”命令安装。
如果系统上不可用gdebi命令,我们可以通过 # apt install gdebi-core安装它:

# gdebi mysql-apt-config_0.8.6-1_all.deb 
Reading package lists... Done
Building dependency tree        
Reading state information... Done
Reading state information... Done
Auto configuration for MySQL APT Repo.
 MySQL is a fast, stable and true multi-user, multi-threaded SQL database
 server. SQL (Structured Query Language) is the most popular database query
 language in the world. The main goals of MySQL are speed, robustness and
 ease of use.
Do you want to install the software package? [y/N]:y

通过选择相应的MySQL Server版本和存储库,请按照安装向导。

安装MySQL 服务器

运行下面命令更新系统的包存储库。

# apt update

使用apt命令安装mysql包。

# apt install mysql-server

上面的命令也将获取并安装MySQL客户端。

安装后,通过访问MySQL控制台确认安装:

# mysql -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.18 MySQL Community Server (GPL)
Copyright (c) 2000, 2015, 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.
mysql>
日期:2020-07-07 20:56:22 来源:oir作者:oir