We can install MariaDB on Ubuntu from the Ubuntu repositories or the official MariaDB repositories. In this tutorial, we’ll go over both the methods in detail.

我们可以从Ubuntu存储库或官方MariaDB存储库在Ubuntu上安装MariaDB。 在本教程中,我们将详细介绍这两种方法。

The preferred way is to make use of the Ubuntu repositories but if you want to download packages that are compiled by MariaDB, then you can the MariaDB repository.

首选方法是利用Ubuntu存储库,但是如果您要下载MariaDB编译的软件包,则可以使用MariaDB存储库。

什么是MariaDB? (What is MariaDB?)

MariaDB is an open-source, community-supported fork of the MySQL relational database system. It is also backward compatible with the MySQL server, so any scripts you’ve written with MySQL in mind will work with MariaDB.

MariaDB是MySQL关系数据库系统的开源,社区支持的分支。 它也与MySQL服务器向后兼容,因此您在考虑MySQL时编写的所有脚本都可与MariaDB一起使用。

MariaDB can be used in a wide array of applications including but not limited to banking and websites to turn data into structured information.

MariaDB可用于各种应用程序中,包括但不限于银行和网站,以将数据转换为结构化信息。

如何在Ubuntu上安装MariaDB? (How to Install MariaDB on Ubuntu?)

We’ll first go over the steps to install MariaDB in Ubuntu using the Ubuntu repository.

我们将首先介绍使用Ubuntu存储库在Ubuntu中安装MariaDB的步骤。

1.使用Ubuntu存储库安装MariaDB (1. Install MariaDB Using Ubuntu Repositories)

Ubuntu gives us access to a pre-compiled package for MariaDB which is accessible through the apt repositories without any configuration. Let’s run the below commands to update the repository index.

Ubuntu使我们可以访问MariaDB的预编译软件包,可以通过apt信息库进行访问,而无需进行任何配置。 让我们运行以下命令来更新存储库索引。


root@ubuntu:~# apt update
Update Ubuntu Packages Using Apt
使用Apt更新Ubuntu软件包

Once the repositories are updated, we will move on to installing the mariadb-server package.

更新存储库后,我们将继续安装mariadb-server软件包。


root@ubuntu:~# apt install mariadb-server
Install MariaDB Server Using Apt
使用Apt安装MariaDB Server

This would take some time depending on the speed of your internet. But once done, you will have a MariaDB server installed in your system.

这将需要一些时间,具体取决于您的互联网速度。 但是一旦完成,您将在系统中安装MariaDB服务器。

We will check the service status of the MariaDB server to check if it’s running, and start the service if it isn’t already.

我们将检查MariaDB服务器的服务状态,以检查其是否正在运行,如果尚未运行,则启动该服务。


root@ubuntu:~# service mariadb status
Service MariaDB Status Output
服务MariaDB状态输出

If you receive the above output stating that the service is active, you’ve successfully installed MariaDB in your system and can verify this by typing one of the below commands.

如果收到上述输出,表明该服务处于活动状态 ,则说明您已经在系统中成功安装了MariaDB,并可以通过键入以下命令之一来进行验证。


root@ubuntu:~# mariadb -V
OR
root@ubuntu:~# mysql -V

The reason why it works with both the commands brings us back to what we discussed at the beginning of this tutorial.

这两个命令都可以使用的原因使我们回到了本教程开头所讨论的内容。

The MariaDB server was made to be backward compatible with MySQL. So any scripts that you’ve written for MySQL should work with MariaDB.

MariaDB服务器被设计为与MySQL向后兼容。 因此,您为MySQL编写的所有脚本都应与MariaDB一起使用。

If you do not see the MariaDB service status as active, you can activate it by using the following command.

如果看不到MariaDB服务状态为活动,则可以使用以下命令将其激活。


root@ubuntu:~# service mariadb start

2.使用MariaDB存储库安装MariaDB (2. Installing MariaDB Using MariaDB Repositories)

To install MariaDB on Ubuntu, we’ll first visit the MariaDB repositories page and select the Linux distribution that we’re working with. In this case, it’s Ubuntu 19.10 “eoan”.

要在Ubuntu上安装MariaDB,我们首先将访问MariaDB存储库页面,然后选择要使用的Linux发行版。 在这种情况下,它是Ubuntu 19.10“ eoan”。

Now, we download the software-properties-common package which allows us to easily add, manage, and remove apt repositories from multiple independent software vendors.

现在,我们下载了software-properties-common软件包,该软件包使我们能够轻松地从多个独立的软件供应商处添加,管理和删除apt存储库。


root@ubuntu:~# apt install software-properties-common

2.1)导入公钥并添加MariaDB源 (2.1) Importing Public Key and Adding MariaDB Sources)

Once installed, we’ll move on to adding the public keys required to access the MariaDB repositories and download packages from there.

安装完成后,我们将继续添加访问MariaDB存储库并从那里下载软件包所需的公钥。

The below line can have a different key-value depending on the distribution you’re working with.

根据您使用的发行版,下一行可以具有不同的键值。


root@ubuntu:~# apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
Import MariaDB Public Keys
导入MariaDB公钥

Now, we’ll add the official MariaDB repositories to our sources list using the command below.

现在,我们将使用下面的命令将正式的MariaDB存储库添加到我们的源列表中。


root@ubuntu:~# add-apt-repository 'deb [arch=amd64] https://mirrors.piconets.webwerks.in/mariadb/repo/10.4/ubuntu eoan main'
Add MariaDB Apt Repositories
添加MariaDB Apt存储库

2.2)替代方法–手动添加MariaDB源 (2.2) Alternative – Manually Adding MariaDB Sources)

If you do not wish to download an additional package to add sources, you can manually add MariaDB sources at the end of the /etc/apt/sources.list file.

如果您不想下载其他软件包来添加源,则可以在/etc/apt/sources.list文件末尾手动添加MariaDB源。

Open the file in your favorite text editor, and paste the two lines at the end of the file.

在您喜欢的文本编辑器中打开文件,然后将两行粘贴到文件末尾。


deb [arch=amd64] https://mirrors.piconets.webwerks.in/mariadb/repo/10.4/ubuntu eoan main
deb-src https://mirrors.piconets.webwerks.in/mariadb/repo/10.4/ubuntu eoan main
Manually Add MariaDB Repositories In Sources
在源中手动添加MariaDB存储库

2.3)更新源代码并安装MariaDB (2.3) Updating Sources and Installing MariaDB)

Now comes the easy part. You’ve added the sources and imported the keys. All we need to do now is to install MariaDB.

现在来简单的部分。 您已经添加了源并导入了密钥。 我们现在要做的就是安装MariaDB。


root@ubuntu:~# apt update
root@ubuntu:~# apt install mariadb-server

If all went well, you should have the MariaDB server installed in your system.

如果一切顺利,则应该在系统中安装MariaDB服务器。

2.4)检查MariaDB安装版本 (2.4) Checking MariaDB Installed Version)

You can check the installed version with either of the commands below. Both of the commands will give you the MariaDB version that’s installed in your system.

您可以使用以下任一命令来检查安装的版本。 这两个命令都将为您提供系统中已安装的MariaDB版本。


root@ubuntu:~# mariadb -V
OR
root@ubuntu:~# mysql -V
Checking MariaDB Installation Version
检查MariaDB安装版本

登录到MariaDB (Logging Into MariaDB)

Similar to how the MariaDB and MySQL commands were used interchangeably above, we can log in to the MariaDB server using either of the commands.

与上面可互换使用MariaDB和MySQL命令的方式类似,我们可以使用任一命令登录到MariaDB服务器。


root@ubuntu:~# mysql -u root
OR
root@ubuntu:~# mariadb -u root
Login To MariaDB Server
登录到MariaDB服务器

结论 (Conclusion)

In this tutorial, we covered how to install MariaDB in Ubuntu. After following all the steps, you should have a working installation of the MariaDB server on your system.

在本教程中,我们介绍了如何在Ubuntu中安装MariaDB。 完成所有步骤之后,您应该在系统上可以正常安装MariaDB服务器。

Also, if you’re interested in setting up WordPress on your Ubuntu system, don’t forget to check out our tutorial on installing WordPress with Nginx on Ubuntu.

另外,如果您有兴趣在Ubuntu系统上设置WordPress,请不要忘记查看我们的有关在Ubuntu上使用Nginx安装WordPress的教程。

翻译自: https://www.journaldev.com/33714/install-mariadb-ubuntu

如何在Ubuntu上安装MariaDB相关推荐

  1. pip安装deb_技术|如何在 Ubuntu 上安装 pip

    pip 是一个命令行工具,允许你安装 Python 编写的软件包. 学习如何在 Ubuntu 上安装 pip 以及如何使用它来安装 Python 应用程序. 有许多方法可以在 Ubuntu 上安装软件 ...

  2. 如何在Ubuntu上安装GCC编译器

    如何在Ubuntu上安装GCC编译器 1.首先更新包列表 sudo apt update 2.安装build-essential软件包: sudo apt install build-essentia ...

  3. 如何在Ubuntu上安装最新版本的Node js

    如何在Ubuntu上安装最新版本的Node.js 作者:chszs,转载需注明.博客主页:http://blog.csdn.net/chszs Node.js是一个软件平台,通常用于构建大规模的服务器 ...

  4. ubuntu ftp服务器_如何在Ubuntu上安装FTP服务器?

    ubuntu ftp服务器 In this tutorial, let's learn how to install FTP server on Ubuntu. FTP or File Transfe ...

  5. couchdb 安装_如何在Ubuntu上安装CouchDB –分步指南

    couchdb 安装 In this tutorial, we'll go over how to install CouchDB on Ubuntu. CouchDB is a NoSQL data ...

  6. ubuntu的web服务器_如何在Ubuntu上安装OpenLiteSpeed Web服务器?

    ubuntu的web服务器 Want to install OpenLiteSpeed Webserver on Ubuntu? Today we're going to do just that. ...

  7. 如何在 ubuntu 上安装 mercury mw150us 网卡驱动

    如何在 ubuntu 上安装 mercury mw150us 网卡驱动 为笔记本购买了这种无线网卡,下面去驱动安装方式 应为lsusb 可以看出obda:8179 这个类型,查了一下这个驱动就是818 ...

  8. r语言使用linux命令,技术|如何在 Ubuntu 上安装和使用 R 语言

    这个教程指导你如何在 Ubuntu 上安装 R 语言.你也将同时学习到如何在 Ubuntu 上用不同方法运行简单的 R 语言程序. R,和 Python 一样,它是在统计计算和图形处理上最常用的编程语 ...

  9. 如何在Ubuntu上安装OnlyOffice Docs 7.1?

    如何在Ubuntu上安装OnlyOffice Docs 7.1? 什么是OnlyOffice Docs? OnlyOffice Docs是一套在线办公软件,可以打开阅读并编辑文档.表格和幻灯片文件,完 ...

最新文章

  1. 【linux】Valgrind工具集详解(二):入门
  2. 智能医疗?轻松实现!
  3. UDP 构建p2p打洞过程的实现原理(持续更新)
  4. 转PHP5+APACHE2.2配置
  5. Android安卓开发-eclipse正确添加第三方jar包
  6. Laravel测试驱动开发 -- 正向单元测试
  7. [转] Optimizely:在线网站A/B测试平台
  8. 怎么修改管家婆服务器密码忘记,管家婆操作员密码找回教程.doc
  9. 2020-12-28
  10. PostgreSQL 常用函数
  11. html div虚线背景,聊聊css绘制虚线
  12. 《技术人创业攻略》-用技术改变世界!
  13. SPQuery 的若干.....小问题.......
  14. 十天就能缓解颈椎病的保健操(图)
  15. 【已解决】script标签里提示Emmet Abbreviation问题(Html和CSS的语法)
  16. kindeditor自定义添加网络视频插件,修改批量图片上传方式flash为h5
  17. mysql utf8和gbk的区别_MySQL字符集 GBK、GB2312、UTF8区别
  18. Linux用wget和curl下载jdk
  19. 制作单词记录App(一)
  20. 北京交通大学计算机保研清华,北京交通大学就读是什么体验?保研率超高!

热门文章

  1. JSP 语法2 都在百分号里面: 5.@符号加JSP三种指令标签 6
  2. 坑爹系列:sizeof运算符
  3. android (java) 网络发送get/post请求参数设置
  4. 语音信号处理基础(二)
  5. WPF在一个窗口中实现多个视图
  6. [转载] python int类数据的内存大小
  7. [转载] python string 字符串转换为字典 dict
  8. FPGA开发设计必经之路:时序分析
  9. Vue.js 学习笔记 六 v-model 双向绑定数据
  10. Jmeter中java接口测试