MariaDB数据库管理系统是MySQL的一个分支,MariaDB的目的是完全兼容MySQL,包括API和命令行,使之能轻松成为MySQL的代替品.phpMyAdmin 是一个以PHP为基础的第三方数据库管理软件,用yum来安装会更方便快捷。
一.安装MariaDB
1.首先关闭防火墙,selinux
systemctl stop firewalld
setenfore 0
2.设置静态IP
vi /etc/sysconfig/network-scripts/ifcfg-ens33
3.安装
yum install mariadb-server.x86_64 mariadb -y
4.安装完成后对数据库进行初始化,并给root用户设置密码
systemctl start mariadb
systemctl enable mariadb
mysql_secure_installation
首先是设置密码,会提示先输入密码
Enter current password for root (enter for none):<–初次运行直接回车
设置密码
Set root password? [Y/n] #是否设置root用户密码,输入y并回车或直接回车
New password: #设置root用户的密码
Re-enter new password: #再输入一次你设置的密码
其他配置
Remove anonymous users? [Y/n] <– 是否删除匿名用户,回车
Disallow root login remotely? [Y/n] <–是否禁止root远程登录,回车,
Remove test database and access to it? [Y/n] <– 是否删除test数据库,回车
Reload privilege tables now? [Y/n] <– 是否重新加载权限表,回车
初始化MariaDB完成,接下来测试登录
mysql -uroot -p [回车,之后输入密码]
完成。
二.安装phpMyAdmin
1.在安装phpMyAdmin之前要先安装epel,不然安装pgpmyadmin时会出现找不到包
yum install epel-release
rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
2.装包
yum install -y httpd mod_ssl php php-mcrypt phpMyAdmin
3.修改配置文件
vi /etc/httpd/conf.d/phpMyAdmin.conf
# phpMyAdmin - Web based MySQL browser written in php
#
# Allows only localhost by default
#
# But allowing phpMyAdmin to anyone other than localhost should be considered
# dangerous unless properly secured by SSL
Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin
<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
Require ip 127.0.0.1 192.168.62.0/24 #在127.0.0.1后面添加192.168.62.0/24
Require ip ::1
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1
</IfModule>
</Directory>
<Directory /usr/share/phpMyAdmin/setup/>
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
Require ip 127.0.0.1 192.168.62.0/24 ##在127.0.0.1后面添加192.168.62.0/24
保存退出
三.测试
1.
systemctl start mariadb
systemctl enable mariadb
systemctl start httpd
systemctl enable httpd
2.在浏览器中输入本机IP/phpmyadmin
3.登陆进入主界面