CentOS安装mariadb

1、 安装

powershell 复制代码
[root@localhost ~]#  yum install mariadb mariadb-server

2、 启动并自启

powershell 复制代码
[root@ecs-3f21 ~]# systemctl enable mariadb --now

3、 查看启动状态

powershell 复制代码
[root@ecs-3f21 ~]# systemctl status mariadb

4、 初始化mariadb并设置root密码

powershell 复制代码
[root@ecs-3f21 ~]# mysql_secure_installation
powershell 复制代码
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 			#直接敲回车进入下一步
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y				# 是否设置密码。输入y	
New password: 			#输入密码
Re-enter new password: 			#确认密码	
Password updated successfully!		
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y			#是否移除匿名用户,选y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y				# 是否禁用root用户远程访问,
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y		#是否移除测试数据库选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!

5、 配置文件及日志所在

powershell 复制代码
配置文件:	/etc/my.cnf
日志文件:	/var/log/mariadb/mariadb.log

mariadb 完全兼容mysql,命令一样!

相关推荐
黑翼杰克斯5 小时前
如何裁剪u-boot,保留其必要功能,使体积尽可能小
linux·1024程序员节
cellurw8 小时前
Day69 SQLite3动态库移植 + BMP图像解析显示 + 进度条控件设计与动态文本管理
linux
nono牛8 小时前
Linux基础指令大全(快速上手)
linux·服务器·windows·智能手机
<但凡.8 小时前
Linux修炼:库制作与原理(一)
linux·运维·服务器
Maple_land10 小时前
编译器的“隐形约定”与本地变量:解锁Linux变量体系的关键密码
linux·运维·服务器·c++·centos
深思慎考11 小时前
微服务即时通讯系统(服务端)——Speech 语音模块开发(2)
linux·c++·微服务·云原生·架构·语音识别·聊天室项目
小蜜蜂爱编程11 小时前
Ubuntu无法开机Failed to activate swap /swapfile
linux·运维·ubuntu
阿巴~阿巴~11 小时前
CPU 指令集、权限与用户态内核态机制
linux·运维·服务器·指令集·权限·用户态内核态
小涵12 小时前
企业SRE/DevOps向的精通Linux课程培训课程
linux·运维·devops·1024程序员节
航Hang*12 小时前
第1章:初识Linux系统——第8节:查看/修改权限控制和ACL
linux·运维·服务器·笔记·操作系统