平时做技术实践时,很多问题不是概念不会,而是细节没串起来。拿“在Ubuntu系统中安装MariaDB数据库的教程”来说,它看着像小点,放到项目里常会牵出环境、配置、兼容性和维护成本。下面按实际采用顺序,把思路、关键写法和容易踩坑的地方讲清楚,便于大家直接对照操作。
实际处理时,MariaDB是一个开源数据库且100%与MySQL兼容,目标是替代MySQL数据库。
MariaDB的背景 :
在这个场景下,2008年,MySQL被后来被Oracle在2010年收购的Sun Microsystems收购了。 最初被Sun公司的收购由于符合项目的需而受到MySQL社区的欢呼,但是这种情绪同时没有持续太久,下面被Oracle的收购,不幸期望远远低于预期。许多MySql的开发者离开了Sun和Oracle公司开始新的项目。在他们中间就有MySQL的新建者以及项目长期技术带头人之一的Michael ‘Monty' Widenius。Monty和他的团队新建了MySQL的一个fork版本并且命名它为MariaDB。
实际处理时,本篇我们会讨论如何在Ubuntu上安装MariaDB。默认上MariaDB的包同时没有在Ubuntu仓库中。要安装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
- ubuntu14.04LTS安装nginx+mariaDB+php7+YAF的方法
- 结合项目来看,在 Ubuntu 16.04 为 Nginx 服务器安装 LEMP 环境(MariaDB,PHP 7 同时兼容 HTTP 2.0)
- Ubuntu安装MariaDB的具体步骤记录