Skip to the content.

Cài đặt Mariadb và phpMyAdmin

I. Cài đặt mariadb

1. Tạo repo cho Marria-DB :

Tạo file /etc/yum.repos.d/MariaDB.repo để làm repo cho mariadb, có nội dung là:

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

2. Cài đặt

rm -rf /var/lib/mysql
yum install MariaDB-server
systemctl start mariadb
systemctl enable mariadb
systemctl status mariadb

Note : - Nếu start bị lỗi , xóa toàn bộ file trong “/var/lib/mysql” và chạy lệnh mysql_install_db

3. Cấu hình

Tập tin cấu hình của MariaDB được lưu tại etc/my.cnf và thư mục /etc/my.cnf.d Các tệp template cấu hình lưu tại : /usr/share/mysql/

Thiết lâp bảo mật cho MariaDB : mysql_secure_installation

II. Cài đặt phpMyAdmin.

1.Cài đặt apache server

phpMyAdmin yêu cầu Apache web server để người dùng tương tác. Cài Apache:

yum install -y httpd
systemctl start httpd
systemctl enable httpd
systemctl status httpd
httpd -v

Cấu hình firewalld:

firewall-cmd --add-service http
firewall-cmd --add-service http --permanent

2. Cài đặt php

yum install php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php-zip php-fileinfo

3. Cài Epel repo để cài đặt phpMyAdmin

yum install -y epel-release

4. Cài đặt phpMyAdmin

<Directory /usr/share/phpMyAdmin/> AddDefaultCharset UTF-8

# Apache 2.4 #Thêm dòng cấu hình "Require all granted"sau đây: Require all granted Require ip 127.0.0.1 Require ip ::1 ``` - Khởi động lại dịch vụ httpd: ``` systemctl restart httpd ``` - Truy cập vào giao diện web của phpMyAdmin: `http:///phpmyadmin` ![](https://i.imgur.com/dlL3vAM.png) - Đăng nhập với tài khoản và mật khẩu của mariadb: ![](https://i.imgur.com/qLXyvkA.png)