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
- Thay đổi root pass
- Xóa anonymous user
- Tắt tính tăng remote login
- Xóa database ‘test’
- Reload table liên quan đến tiền
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
- Cài đặt sử dụng lệnh:
yum install phpmyadmin
- Cấu hình cho phép truy cập từ (không chỉ qua localhost) bằng cách thay đổi file cấu hình /etc/httpd/conf.d/phpMyAdmin.conf : ```conf
<Directory /usr/share/phpMyAdmin/> AddDefaultCharset UTF-8