1、安装MariaDB

通过yum安装就行了。简单快捷,安装mariadb-server,默认依赖安装mariadb,一个是服务端、一个是客户端。

  1. [root@mini ~]# yum install mariadb-server

2、配置MariaDB
1)安装完成后首先要把MariaDB服务开启,并设置为开机启动

  1. [root@mini ~]# systemctl start mariadb # 开启服务
  2. [root@mini ~]# systemctl enable mariadb # 设置为开机自启动服务

2)首次安装需要进行数据库的配置,命令都和mysql的一样

  1. [root@mini ~]# mysql_secure_installation

3)配置时出现的各个选项

复制代码
Enter current password for root (enter for none): # 输入数据库超级管理员root的密码(注意不是系统root的密码),第一次进入还没有设置密码则直接回车

  1. Set root password? [Y/n] # 设置密码,y
  2. New password: # 新密码
  3. Re-enter new password: # 再次输入密码
  4. Remove anonymous users? [Y/n] # 移除匿名用户, y
  5. Disallow root login remotely? [Y/n] # 拒绝root远程登录,n,不管y/n,都会拒绝root远程登录
  6. Remove test database and access to it? [Y/n] # 删除test数据库,y:删除。n:不删除,数据库中会有一个test数据库,一般不需要
  7. Reload privilege tables now? [Y/n] # 重新加载权限表,y。或者重启服务也许
  8. 复制代码

4)测试是否能够登录成功,出现 MariaDB [(none)]> 就表示已经能够正常登录使用MariaDB数据库了

  1. [root@mini ~]# mysql -u root -p
  2. Enter password:
  3. Welcome to the MariaDB monitor. Commands end with ; or \g.
  4. Your MariaDB connection id is 8
  5. Server version: 5.5.60-MariaDB MariaDB Server
  6. Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
  7. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  8. MariaDB [(none)]>

这样子就算成了。哈。

分类: web

标签:   mariaDB