centos 安装mariaDB的方法步骤

MariaDB数据库介绍:

MariaDB数据库管理系统是MySQL的一个分支,主要由开源社区在维护,采用GPL授权许可。开发这个分支的原因之一是:甲骨文公司收购了 MySQL后,有将MySQL闭源的潜在风险,因此社区采用分支的方式来避开这个风险。 MariaDB的目的是完全兼容MySQL,包括API和命令行,使之能轻松成为MySQL的代替品。在存储引擎方面,使用XtraDB(英 语:XtraDB)来代替MySQL的InnoDB。

MariaDB 与 MySQL 相比较

MariaDB 更强的地方在于:

  • Maria 存储引擎
  • PBXT 存储引擎
  • XtraDB 存储引擎
  • FederatedX 存储引擎
  • 更快的复制查询处理
  • 线程池
  • 更少的警告和bug
  • 运行速度更快
  • 更多的 Extensions (More index parts, new startup options etc)
  • 更好的功能测试
  • 数据表消除
  • 慢查询日志的扩展统计
  • 支持对 Unicode 的排序

MariaDB数据库在centos下的安装步骤:

安装前,如果您的服务器中安装有 MySQL ,那么您需要删除它。删除命令:

[root@server ~]# yum remove mysql* mysql-server mysql-devel mysql-libs

为了让 MariaDB 同时兼容 MySQL,我们需要安装 REMI 库来解决兼容性和安装 MariaDB 时软件包依赖性问题。安装命令:

[root@server ~]# rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm 

安装兼容 mysql55 包命令:

[root@server ~]# yum –enablerepo=remi-test –disablerepo=remi install compat-mysql55

为 MariaDB 创建一个 repository 文件,并在其中输入如下代码:

32 位系统:

[root@server ~]# vi /etc/yum.repos.d/mariadb.repo
# MariaDB 5.5 CentOS repository list – created 2013-06-06 07:42 UTC
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5/centos6-x86
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1 

64 位系统: 

[root@server ~]# vi /etc/yum.repos.d/mariadb.repo
# MariaDB 5.5 CentOS repository list – created 2013-06-06 07:53 UTC
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5/centos6-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1 

保存并退出该文件,并运行 yum update 命令:

[root@server ~]# yum update 

现在开始安装 MariaDB :

[root@server ~]# yum install MariaDB-devel MariaDB-client MariaDB-server -y 

安装完毕后,启动 MariaDB 服务,并让它在每次重启服务器后自动启动。

[root@server ~]# /etc/init.d/mysql start
Starting MySQL… SUCCESS!
[root@server ~]# chkconfig mysql on 

为 MySQL 的 root 设置密码,默认情况下,MySWL root 密码是空的。为了防止未经授权的用户访问 MySQL 我们需要设置 root 用户密码:

[root@server ~]# /usr/bin/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): 
OK, successfully used password, moving on…

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

You already have a root password set, so you can safely answer ‘n’.

Change the root password? [Y/n] 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] 
 … 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] 
 … 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] 
 - Dropping test database…
ERROR 1008 (HY000) at line 1: Can’t drop database ‘test’; database doesn’t exist
 … Failed!  Not critical, keep moving…
 - 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] 
 … 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! 

 

来源://作者:/更新时间:2013-11-06
相关文章
评论:
验证码:
匿名评论:

最新文章

新热推荐

文章排行