大家好,又见面了,我是你们的朋友全栈君。
以下介绍在Ubuntu 18.04系统上安装MariaDB 10.4,也适用在Ubuntu 16.04系统上,我们可以从APT存储库在Ubuntu上安装MariaDB 10.4。MariaDB是MySQL的直接替代品,具有更多功能,新存储引擎和更好的性能。在写本文时,MariaDB 10.4可在Beta版本中使用了,如果你想使用正式版本,就用MariaDB 10.3。
相关链接
在Ubuntu 18.04上安装MariaDB 10.4的具体步骤
要在Ubuntu 18.04上安装MariaDB,需要将MariaDB存储库添加到系统中。
第一步、安装software-properties-common,如果缺少则进行安装:
sudo apt-get install software-properties-common
第二步、导入MariaDB gpg密钥:
运行以下命令将Repository Key添加到系统:
sudo apt-key adv –recv-keys –keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
第三步、添加apt存储库
导入PGP密钥后,继续添加存储库URL:
sudo add-apt-repository “deb [arch=amd64,arm64,ppc64el] http://mariadb.mirror.liquidtelecom.com/repo/10.4/ubuntu $(lsb_release -cs) main”
第四步、在Ubuntu 18.04上安装MariaDB Server
1、最后一步是安装MariaDB Server:
sudo apt update
sudo apt -y install mariadb-server mariadb-client
2、系统将提示输入MariaDB root密码,输入要设置的密码:
3、确认密码:
按确认新密码并安装MariaDB,请确保在密码管理器上记住或保留提供的密码。
4、安装后应自动启动该服务:
$ sudo systemctl status mysql
* mariadb.service – MariaDB 10.4.1 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 Tue 2018-12-25 08:26:18 PST; 24min ago
Docs: man:mysqld(8)
https://mariadb.com/kb/en/library/systemd/
Main PID: 7564 (mysqld)
Status: “Taking your SQL requests now…”
Tasks: 32 (limit: 1110)
CGroup: /system.slice/mariadb.service
`-7564 /usr/sbin/mysqld
Dec 25 08:26:23 ubuntu-01 /etc/mysql/debian-start[7604]: Running ‘mysqlcheck’ with connection arguments: –port=’3306′ –socket=’/var/run/mysqld/mysqld
Dec 25 08:26:23 ubuntu-01 /etc/mysql/debian-start[7604]: # Connecting to localhost…
Dec 25 08:26:23 ubuntu-01 /etc/mysql/debian-start[7604]: # Disconnecting from localhost…
Dec 25 08:26:23 ubuntu-01 /etc/mysql/debian-start[7604]: Processing databases
Dec 25 08:26:23 ubuntu-01 /etc/mysql/debian-start[7604]: information_schema
Dec 25 08:26:23 ubuntu-01 /etc/mysql/debian-start[7604]: performance_schema
Dec 25 08:26:23 ubuntu-01 /etc/mysql/debian-start[7604]: Phase 7/7: Running ‘FLUSH PRIVILEGES’
Dec 25 08:26:23 ubuntu-01 /etc/mysql/debian-start[7604]: OK
Dec 25 08:26:23 ubuntu-01 /etc/mysql/debian-start[7706]: Checking for insecure root accounts.
Dec 25 08:26:23 ubuntu-01 /etc/mysql/debian-start[7710]: Triggering myisam-recover for all MyISAM tables and aria-recover for all Aria tables
5、使用mysql命令测试登录MariaDB shell:
$ mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or g.
Your MariaDB connection id is 47
Server version: 10.4.1-MariaDB-1:10.4.1 maria~bionic-log mariadb.org binary distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type ‘help;’ or ‘h’ for help. Type ‘c’ to clear the current input statement.
MariaDB [(none)]>
6、使用以下命令检查版本:
得出的版本号是MariaDB-1:10.4.1。到这里,你就可以在Ubuntu 18.04系统上使用MariaDB 10.4了。
相关主题
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/140872.html原文链接:https://javaforall.cn