1、MariaDB介绍

以root用户登录终端。
MySQL之父Widenius先生离开了Sun之后,觉得依靠Sun/Oracle来发展MySQL,实在很不靠谱,于是决定另开分支,这个分支的名字叫做MariaDB。
MariaDB跟MySQL在绝大多数方面是兼容的(连启动客户端命令都一样mysql -u [user] -p),对于开发者来说,几乎感觉不到任何不同。目前MariaDB是发展最快的MySQL 5.0分支版本,新版本发布速度已经超过了Oracle官方的MySQL版本。(在MYSQL10.后和MariaDB(相当于mysql5.0)还是有区别的,比如支持的字符)。
**注意:现在大多linux系统通过命令安装mysql时默认安装的是MariaDB*

2、安装与配置

(1)通过命令安装(大多linux系统支持)

  1. [root@localhost bin]#yum install mariadb mariadb-server //
  2. [root@localhost bin]# systemctl start mariadb //启动 mariadb
  3. 或命令
  4. [root@localhost bin]# systemctl start mysqld.service
  5. [root@localhost bin]# systemctl enable mariadb //设备开机自启

(2)安全配置(与MySQL一致)

  1. root@mate-Vostro-14-5459:~# mysql_secure_installation //启动配置命令
  2. Securing the MySQL server deployment.
  3. Connecting to MySQL using a blank password.
  4. #1.问你是否要评估密码安全性,我选的N
  5. VALIDATE PASSWORD COMPONENT can be used to test passwords
  6. and improve security. It checks the strength of password
  7. and allows the users to set only those passwords which are
  8. secure enough. Would you like to setup VALIDATE PASSWORD component?
  9. Press y|Y for Yes, any other key for No: N
  10. #2.设置root用户密码
  11. Pease set the password for root here.
  12. New password:
  13. Re-enter new password:
  14. Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
  15. #3.问你是不是要删除安装时设置的匿名用户,我选的N
  16. By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without
  17. having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother.
  18. You should remove them before moving into a production environment.
  19. Remove anonymous users? (Press y|Y for Yes, any other key for No) : n
  20. ... skipping
  21. #4.问你是不是要禁用允许远程访问root用户,我选的不禁用N.
  22. Normally, root should only be allowed to connect from
  23. 'localhost'. This ensures that someone cannot guess at
  24. the root password from the network.
  25. Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
  26. Success.
  27. #4.问你是不是要删除安装时创建的test数据库,我选的不N.
  28. By default, MySQL comes with a database named 'test' that
  29. anyone can access. This is also intended only for testing,
  30. and should be removed before moving into a production environment.
  31. Remove test database and access to it? (Press y|Y for Yes, any other key for No) : n
  32. ... skipping.
  33. #4.问你是不是要重新加载权限文件,我选的是Y.
  34. Reloading the privilege tables will ensure that all changes
  35. made so far will take effect immediately.
  36. Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
  37. Success.
  38. All done!
  39. 2)配置完成后检查服务器状态
  40. root@mate-Vostro-14-5459:~#systemctl status mysql.service
  41. //显示如下结果说明mysql服务是正常的:
  42. mysql.service - MySQL Community Server
  43. Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: en
  44. Active: active (running) since Sat 2018-06-23 11:09:03 CST; 6min ago
  45. Main PID: 14078 (mysqld)
  46. Tasks: 29 (limit: 4915)
  47. CGroup: /system.slice/mysql.service
  48. └─14078 /usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pi
  49. 5 4 11:09:02 weision systemd[1]: Starting MySQL Community Server...
  50. 5 4 11:09:03 weision systemd[1]: Started MySQL Community Server.