MariaDB数据库管理系统是MySQL的一个分支,主要由开源社区在维护,采用GPL授权许可 MariaDB的目的是完全兼容MySQL,包括API和命令行,使之能轻松成为MySQL的代替品。
一、安装启动
安装mariadb相关软件包
yum install mariadb mariadb-server -y
启动mariadb相关服务
systemctl start mariadb
systemctl status mariadb
初始化数据库
mysql_secure_installation
Enter current password for root (enter for none): #首次运行直接回车,非首次运行输入root密码
Set root password? [Y/n] #是否设置root用户密码,输入y并回车或者直接回车
New password: #设置root用户密码
Re-enter new password: #再一次输入你设置的密码
Remove anonymous users? [Y/n] #是否删除匿名用户
Disallow root login remotely? [Y/n] #是否禁止root远程登录
Remove test database and access to it? [Y/n] #是否删除test 测试数据库
Reload privilege tables now? [Y/n] #是否重新加载权限表
二、测试
#克隆测试数据
git clone https://github.com/datacharmer/test_db.git
cd test_db
#导入测试数据,root的数据库密码设置的为loongson
mysql -uroot -ploongson < employees.sql
#查询导入的数据库下面的表
bash sql_test.sh “mysql -uroot -ploongson” 2 > /dev/null
#查询导入的employees库下employees表的数据
MariaDB [(none)]> select * from employees.employees;