CentOS7 安装MariaDB

    mariadb是Mysql的原做者在Mysql被甲骨文收购闭源之后另开公司另开分支搞出来的,如今维基百科和google都已经放弃了mysql,开始转向mariadb,因此我也赶新潮,装一个试试。其实用起来应该和mysql没什么区别,除了名字不同。另外如今Ubuntu、centOS、fedora都已经把mysql从软件列表替换成了mariadb了。闲话很少说了,直接进入正题。mysql

    看了一些CentOS6安装的教程,我就直接开装,结果报错了,我原本想装个10.0.14,最后解决了问题,却装了5.5,其实也没太大区别,遇到的问题和解决方式是同样的。在google上看了一个很是好的指导,sql

http://sharadchhetri.com/2014/09/28/install-mariadb-server-10-on-centos-7-and-rhel-7-by-using-yum/shell

我把我用到的步骤简单翻译了一下:数据库

  • 建立一个/etc/yum.repos.d/MariaDB.repo文件,什么su-sudo我就省了,文件主要内容以下centos

[mariadb]  
name = MariaDB  
baseurl = http://yum.mariadb.org/5.5/centos6-amd64  
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB  
gpgcheck=1

那个baseurl能够修改,你们能够本身到http://yum.mariadb.org找一找喜欢的版本
post

  • 直接开装google

yum install MariaDB-server MariaDB-client MariaDB-devel MariaDB-shared

到这一步就会遇到问题了,安装会有冲突url

Transaction check error:
file /etc/my.cnf from install of MariaDB-common-10.0.14-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.35-3.el7.x86_64
file /usr/share/mysql/charsets/Index.xml from install of MariaDB-common-10.0.14-1.el6.x86_64 conflicts with file from package mariadb-libs-1:5.5.35-3.el7.x86_64
翻译

通常就是这个报错信息,简单说就是现有的一个lib和咱们将要的安装冲突了,卸了丫聴的,但有个postfix依赖于它,因此要先卸载:code

yum remove postfix
rpm -ev mariadb-libs-5.5.35-3.el7.x86_64

而后再次执行咱们的安装命令就能够了,安装成功之后能够再把postfix装回来,其实我也不知道这玩意儿有嘛用。这回应该就能够了。

  • 启动mysql服务

固然用centOS推荐的新命令了

systemctl start mysql.service

  • 初始化

使用mysql_secure_installation命令进行初始化。跟着提示走就能够了

Enter current password for root (enter for none): [直接回车,原本就没有]
Set root password? [Y/n] y
New password: [Give your password]
Re-enter new password: [Rewrite your given password]
Remove anonymous users? [Y/n] y[删除匿名用户访问]
Disallow root login remotely? [Y/n] y[禁止远程使用root登录]
Remove test database and access to it? [Y/n] y[删除test数据库]
Reload privilege tables now? [Y/n] y

这些都随你喜爱,搞定。

相关文章
相关标签/搜索