首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >CentOS 7.2 安装MariaDB

CentOS 7.2 安装MariaDB

作者头像
shaonbean
发布2019-05-26 09:28:41
8800
发布2019-05-26 09:28:41
举报
文章被收录于专栏:运维前线运维前线

版权声明:本文为木偶人shaon原创文章,转载请注明原文地址,非常感谢。 https://cloud.tencent.com/developer/article/1434662

MariaDB简介

  • MariaDB数据库管理系统是MySQL的一个分支,主要由开源社区在维护,采用GPL授权许可 MariaDB的目的是完全兼容MySQL,包括API和命令行,使之能轻松成为MySQL的代替品。在存储引擎方面,使用XtraDB(英语:XtraDB)来代替MySQL的InnoDB。 MariaDB由MySQL的创始人Michael Widenius(英语:Michael Widenius)主导开发,他早前曾以10亿美元的价格,将自己创建的公司MySQL AB卖给了SUN,此后,随着SUN被甲骨文收购,MySQL的所有权也落入Oracle的手中。MariaDB名称来自Michael Widenius的女儿Maria的名字。
  • MariaDB 官网:https://mariadb.org/
  • MariaDB 下载:https://downloads.mariadb.org/
  • MariaDB Github地址:https://github.com/MariaDB/server

安装MariaDB 5.5

  • 安装MariaDB 5.5是CentOS 7的默认版本,配置数据库服务器
[root@linuxprobe~]# yum -y install mariadb-server
[root@linuxprobe~]# vi /etc/my.cnf
# add follows within [mysqld] section
[mysqld]
character-set-server=utf8
[root@linuxprobe~]# systemctl start mariadb
[root@linuxprobe~]# systemctl enable mariadb
ln -s '/usr/lib/systemd/system/mariadb.service' '/etc/systemd/system/multi-user.target.wants/mariadb.service' 
  • 初始化MariaDB
[root@linuxprobe~]# mysql_secure_installation   #和MySQL一样,一路y
  • 连接MariaDB
[root@linuxprobe ~]# mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 1023
Server version: 5.5.50-MariaDB MariaDB Server

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> select user,host,password from mysql.user;
+-----------+-----------+-------------------------------------------+
| user      | host      | password                                  |
+-----------+-----------+-------------------------------------------+
| root      | localhost | *F1DAE8BCDFCA7A57F246E0F834AC35830A3D640E |
| root      | 127.0.0.1 | *F1DAE8BCDFCA7A57F246E0F834AC35830A3D640E |
| root      | ::1       | *F1DAE8BCDFCA7A57F246E0F834AC35830A3D640E |
+-----------+-----------+-------------------------------------------+
5 rows in set (0.00 sec)
MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
+--------------------+
5 rows in set (0.05 sec)
MariaDB [(none)]> exit;
Bye
  • 防火墙开启3306端口
# 客户端设置
[root@vdevops ~]# firewall-cmd --add-service=mysql --permanent
success
[root@vdevops ~]# firewall-cmd --reload
success

安装phpMyAdmin

前提安装web服务器和php,参考下面: http://blog.csdn.net/wh211212/article/details/52982917 http://blog.csdn.net/wh211212/article/details/52994505

  • 安装phpMyAdmin
 # install from EPEL
[root@linuxprobe~]# yum --enablerepo=epel -y install phpMyAdmin php-mysql php-mcrypt
[root@linuxprobe~]# vi /etc/httpd/conf.d/phpMyAdmin.conf
# line 17: IP address you permit to access
Require ip 127.0.0.1 10.1.1.0/24
# line 34: IP address you permit to access
Require ip 127.0.0.1 10.1.1.o/24
[root@linuxprobe ~]# systemctl restart httpd 
  • 使用Web浏览器从客户端访问“http://(您的主机名或IP地址)/ phpmyadmin /’,然后在MariaDB的用户在以下屏幕上登录。此示例使用root用户继续。
  • 登录之后,您可以在这里操作MariaDB

MariaDB 主从复制

MariaDB 主从复制和MySQL主从复制相同,请移步到:http://blog.csdn.net/wh211212/article/details/53105335

安装 MariaDB 10.1

  • 配置 CentOS SCLo源仓库
[root@linuxprobe ~]# yum --enablerepo=centos-sclo-rh -y install rh-mariadb101-mariadb-server
  • 来自centos-sclo-rh的软件包安装在/ opt目录下。 要使用它,加载环境变量如下。
[root@linuxprobe ~]# scl enable rh-mariadb101 bash 
[root@linuxprobe ~]# mysql -V
mysql  Ver 15.1 Distrib 10.1.14-MariaDB, for Linux (x86_64) using  EditLine wrapper
[root@linuxprobe ~]# which mysql
/opt/rh/rh-mariadb101/root/usr/bin/mysql
  • 如果您希望在登录时自动启用MariaDB 10.1,请如下配置
[root@linuxprobe ~]# vi /etc/profile.d/rh-mariadb101.sh
# create new
#!/bin/bash
source /opt/rh/rh-mariadb101/enable
export X_SCLS="`scl enable rh-mariadb101 'echo $X_SCLS'`"
  • 启用MariaDB 10.1并配置初始设置
[root@linuxprobe ~]# mysql_secure_installation 
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2016年11月11日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • MariaDB简介
  • 安装MariaDB 5.5
  • 安装phpMyAdmin
  • MariaDB 主从复制
  • 安装 MariaDB 10.1
相关产品与服务
云数据库 SQL Server
腾讯云数据库 SQL Server (TencentDB for SQL Server)是业界最常用的商用数据库之一,对基于 Windows 架构的应用程序具有完美的支持。TencentDB for SQL Server 拥有微软正版授权,可持续为用户提供最新的功能,避免未授权使用软件的风险。具有即开即用、稳定可靠、安全运行、弹性扩缩等特点。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档