使用CentOS7的yum工具安装最新版本的MariaDB

浏览官方网站时发现了一条简洁的话,我记了下来
#2018/6/3 由于命令有些变化,所以进行了更新

一句话中没有环境依赖,但是需要说明的是:
主操作系统:CentOS 7.3
目标数据库:MariaDB 10.2

仓库安装

$ curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash
只需要执行这个命令

如果您想要指定版本,请运行以下命令:
$ curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash -s — –mariadb-server-version=mariadb-10.0

其他选项请参考以下网址:
https://mariadb.com/kb/en/the-mariadb-library/mariadb-package-repository-setup-and-usage/

安装MariaDB

安装

请使用以下命令在您的计算机上安装MariaDB服务器和MariaDB客户端:
$ sudo yum安装MariaDB-server MariaDB-client

服务开始

$ sudo systemctl start mariadb
请使用sudo systemctl start mariadb命令启动mariadb服务。

起動时开始服务

请使用以下命令将MariaDB设为系统启动项:$ sudo systemctl enable mariadb

确认连接

$ mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.                                            
Your MariaDB connection id is 8                    
Server version: 10.2.8-MariaDB MariaDB Server      

Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.                                   

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.                         

MariaDB [(none)]> 

如果那样的话就完成了

通过执行命令 “mysql_secure_installation” 来进行初始设置。

考虑

下面是一些支持的操作系统:
– Red Hat Enterprise Linux (RHEL)/CentOS 6和7
– Debian 7 (wheezy)和8 (jessie)
– Ubuntu 14.04 LTS (trusty)和16.04 LTS (xenial)
– SUSE Linux Enterprise Server (SLES) 12