概述:LAMP架构盛极一时,这离不开MySQL的免费与易用,但是在Oracle收购了Sun之后,很多公司开始担忧MySQL的开源前景,而最近Oracle进一步闭源的举措更是让人难以安心,众多互联网公司纷纷开始寻求MySQL的替代方案。mariaDB原是mysql的一个分支,在mysql创始人加入后,更加吸引了大众的目光。
1.安装mariaDB
我们一直使用的RHEL7的自带yum源已经有了mariadb的rpm包,我们可以使用yum非常方便的安装。
[root@localhost dhcp]# yum install mariadb-server -y
[root@localhost dhcp]# yum list all | grep mariadb
mariadb-server.x86_64 1:5.5.35-3.el7 rhel_dvd
但是yum提供的mariadb的版本实在是有点低,我们去看下mariadb官网。
官网上已经出了10.2.2的beta版本,不过人家可提示你了,不要在生产环境使用beta版。这篇博客的主要目的是对常用语句的总结,就先不尝试这个的源码安装了。
2.使用mariaDB
打开mariadb服务[root@localhost dhcp]# systemctl start mariadb
修改mariadb配置文件使其跳过网络使用skip-networking=1
[root@localhost dhcp]# mysql_secure_installation先进行数据库安全初始化,下面会有很多文字提示你。
进入数据库/usr/bin/mysql_secure_installation: line 379: find_mysql_client: command not found 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): ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) 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 New password:
[root@localhost dhcp]# mysql -uroot -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 11 Server ve