MariaDB简介与历史背景
MariaDB是一款完全开源的数据库系统,它与MySQL保持100%兼容性,主要目标是成为MySQL数据库的替代方案。 MariaDB的历史背景:
配置MariaDB仓库源
2008年,Sun Microsystems收购了MySQL,随后Oracle于2010年收购了Sun公司。起初,Sun的收购因符合项目需求而受到MySQL社区的欢迎,但这种热情并未持续太久。Oracle的收购让许多人的期望落空。随着MySQL的创建者及长期技术带头人Michael 'Monty' Widenius等核心开发者离开Sun和Oracle,他们启动了新项目。Monty及其团队基于MySQL创建了一个分支版本,并将其命名为MariaDB。 本文将探讨如何在Ubuntu上安装MariaDB。默认情况下,Ubuntu仓库中不包含MariaDB包,因此首先需要配置MariaDB的仓库源。 配置 MariaDB 仓库
执行MariaDB安装命令
$ sudo apt-get install software-properties-common
$ sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db
$ sudo add-apt-repository 'deb http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.0/ubuntu trusty main'
设置数据库管理员密码
安装 MariaDB:
$ sudo apt-get update
$ sudo apt-get install mariadb-server
命令行连接数据库
在安装过程中,系统会提示用户设置MariaDB的root账户密码。

管理服务运行状态
通过命令行连接到MariaDB:
linuxtechi@mail:~$ mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 40
Server version: 10.0.14-MariaDB-1~trusty-log mariadb.org binary distribution
Copyright (c) 2000, 2014, Oracle, SkySQL Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
MariaDB 服务管理
$ sudo /etc/init.d/mysql stop
$ sudo /etc/init.d/mysql start