如何在Debian 9/Debian 8上安装MariaDB 10.4
时间:2020-02-23 14:40:54 来源:igfitidea点击:
在本教程中,我们将介绍如何在Debian 9 Stretch和Debian 8 Jessie上安装MariaDB 10.4. MariaDB是在通用公共许可证版本2下发布的开源数据库服务器。它是社区开发的MySQL关系数据库管理系统的分支,构建起来速度快,功能强大。
如何在Debian 9/Debian 8上安装MariaDB 10.4
在Debian 9/Debian 8上安装MariaDB 10.4之前,需要添加官方的MariaDB上游存储库,其中包含用于MariaDB的二进制软件包。
安装依赖包
sudo apt -y install software-properties-common dirmngr
添加MariaDB 10.4存储库并导入GPG密钥
对于Debian 9:
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xF1656F24C74CD1D8 sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://mirror.zol.co.zw/mariadb/repo/10.4/debian stretch main'
对于Debian 8:
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://mirror.zol.co.zw/mariadb/repo/10.4/debian jessie main'
安装MariaDB数据库服务器
导入密钥并添加存储库后,可以使用以下命令安装MariaDB:
sudo apt update && sudo apt install mariadb-server mariadb-client
当提示我们设置root密码时,请提供密码。
确认要设置的root密码。
完成后,它将完成安装并启动mysql服务。我们可以使用以下方法检查状态:
$sudo systemctl status mysql ● mariadb.service - MariaDB 10.4.6 database server Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled) Drop-In: /etc/systemd/system/mariadb.service.d └─migrated-from-my.cnf-settings.conf Active: active (running) since Sun 2019-07-07 10:43:37 CEST; 2min 14s ago Docs: man:mysqld(8) https://mariadb.com/kb/en/library/systemd/ Main PID: 4622 (mysqld) Status: "Taking your SQL requests now…" CGroup: /system.slice/mariadb.service └─4622 /usr/sbin/mysqld ......................
我们也可以登录以检查数据库版本:
$mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 10 Server version: 10.4.6-MariaDB-1:10.4.6+maria~stretch mariadb.org binary distribution Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> SELECT VERSION(); +-------------------------------------------+ | VERSION() | +-------------------------------------------+ | 10.4.6-MariaDB-1:10.4.6+maria~stretch | +-------------------------------------------+ 1 row in set (0.001 sec) MariaDB [(none)]> QUIT Bye
安装桌面数据库管理工具
如果我们不喜欢使用MySQL命令行,请考虑安装数据库工具来为我们提供帮助。
在Ubuntu上安装和配置DBeaver