(1)yum安装程序
1234567891011121314151617 [root@johnson's linux ~]# yum install mariadb-server
========================================================================================
Installing:
mariadb-server x86_64 1:5.5.44-2.el7.centos base 11 M
Installing for dependencies:
mariadb x86_64 1:5.5.44-2.el7.centos base 8.9 M
perl-Compress-Raw-Bzip2 x86_64 2.061-3.el7 base 32 k
perl-Compress-Raw-Zlib x86_64 1:2.061-4.el7 base 57 k
perl-DBD-MySQL x86_64 4.023-5.el7 base 140 k
perl-DBI x86_64 1.627-4.el7 base 802 k
perl-IO-Compress noarch 2.061-2.el7 base 260 k
perl-Net-Daemon noarch 0.48-5.el7 base 51 k
perl-PlRPC noarch 0.2020-14.el7 base 36 k
Transaction Summary
========================================================================================
一大推依赖包,只要有yum在且yum源配置没有问题,可以轻松解决
(2)启动服务,执行安全安装操作
12345678910111213141516171819202122232425262728293031323334353637383940414243444546 [root@johnson's linux ~]# systemctl start mariadb
# 查看监听端口,3306为mariaDB的默认监听端口
[root@johnson's linux ~]# ss -tnl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 50 *:3306 *:*
LISTEN 0 128 *:22 *:*
LISTEN 0 128 :::22 :::*
执行安全安装操作
[root@johnson's linux ~]# mysql_secure_installation
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
Set root password? [Y/n] y # 设置管理员登陆秘密(此密码和linux系统的root没关系)
New password:
Re-enter new password: # 输入密码即可
Password updated successfully!
Reloading privilege tables..
... Success!
Remove anonymous users? [Y/n] y # 是否移除匿名用户(在执行安全安装之前不需要密码登陆)
... Success! # 允许匿名登陆时很危险的,建议移除
Disallow root login remotely? [Y/n] n # 是否不允许管理员账号远程登陆,一般情况下建议不允许
... skipping.
Remove test database and access to it? [Y/n] y # 移除测试数据库
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y # 重载权限表
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!