Tag Archives: MariaDB

How To Install phpMyAdmin on CentOS 7

In this tutorial, we will go through the steps to installing and configuring phpMyAdmin in CentOS 7.

All commands – without sudo

yum update -y 
yum install epel-release -y 
yum install phpmyadmin -y 

All commands – with sudo

sudo yum update -y 
sudo yum install epel-release -y
sudo yum install phpmyadmin -y

Introduction

phpMyAdmin is an open source tool for managing and interacting with MySQL databases. phpMyAdmin uses a web-based management interface which allows users to interact with databases through web browser. It allows us to manage database users and privileges, import and export databases, execute database queries and more.

Prerequisites

Step 1. Update your system

Start by updating the system. You can use the below command.

yum update -y 

Step2. Add Repo

Since phpMyAdmin is not available in CentOS 7’s default repository, we need to add the Extra Packages for Enterprise Linux (EPEL) repo by executing the below command.

yum install epel-release -y 

Step 3. Install phpMyAdmin

After adding the repo, you can install phpMyAdmin using the yum package by typing the below command:

yum install phpmyadmin -y 

For phpMyAdmin to work properly, we need to make some changes to the configuration file. Open the configuration file using your text editor.

vi /etc/httpd/conf.d/phpMyAdmin.conf

By default the configuration is set up to access the connection only from localhost. In order to work remotely, you will need to specify the addresses in the configuration file.

Add your remote IP to the respective lines on the configuration as shown below.

Require ip your_ip_address
Allow from your_ip_address

Restart Apache to apply the modifications.

systemctl restart httpd

Now you can access phpMyAdmin using the URL below.

http://server_domian_or_ip/phpmyadmin
How To Install phpMyAdmin in CentOS 7

How To Install phpMyAdmin in CentOS 7

To login, use a valid username and password of a MariaDB user. You can the root user and MariaDB administrative pass to login by default. You can then access the administrative interface:

How To Install phpMyAdmin in CentOS 7

How To Install phpMyAdmin in CentOS 7

Conclusion

You’ve successfully installed phpMyAdmin on your CentOS 7 machine. Now you can manage your databases through a web interface. You can manage databases, users, and tables, perform various other MySQL queries and operations.

How to Install MariaDB/MySQL on CentOS 7

In this guide we’ll go through the steps for installing the latest version of MariaDB on CentOS 7.

All Commands – without sudo

yum update -y
echo -e "[mariadb]\nname=MariaDB Repository\nbaseurl=http://yum.mariadb.org/10.3/centos7-amd64\ngpgcheck=1\ngpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB" | tee /etc/yum.repos.d/MariaDB.repo
yum install mariadb-server mariadb-client -y
systemctl start mariadb 
systemctl enable mariadb
mysql_secure_installation

All Commands – with sudo

sudo yum update -y
sudo yum install mariadb-server mariadb-client -y
echo -e "[mariadb]\nname=MariaDB Repository\nbaseurl=http://yum.mariadb.org/10.3/centos7-amd64\ngpgcheck=1\ngpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB" | sudo tee /etc/yum.repos.d/MariaDB.repo 
sudo systemctl start mariadb 
sudo systemctl enable mariadb
sudo mysql_secure_installation

 

MariaDB is the default database management system in CentOS 7 and is a drop-in replacement for MySQL. It is an opensource relational database that uses the Structured Query Language (SQL) to manage its data. 

Prerequisites

  • A CentOS 7 VPS
  • Sudo access

Update Your System

Log in as a sudo user and then update your system.

yum update -y

Install MariaDB

At the time of writing this article, the latest version of MariaDB is version 10.3. If you want a different version of MariaDB, go to the official MariaDB repositories page and generate a repository file for the specific MariaDB version you require.

To enable the MariaDB repository, create a repository file named MariaDB.repo and add the following content in /etc/yum.repos.d/MariaDB.repo

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

Install the MariaDB server and client packages using yum.

yum install mariadb-server mariadb-client -y

Now that MariaDB has installed successfully, run the following command to start and enable the service.

systemctl start mariadb

systemctl enable mariadb

To prevent unauthorized access to your database and remove some dangerous defaults run the following command.

mysql_secure_installation

You will be prompted with an option to change the MariaDB root password, remove anonymous user accounts, disable root logins outside of localhost, remove test databases and reload privileges. It is recommended that you answer ‘yes’ to these options to secure the database server.

Verify the Installation

Run the following to test to get info about the installation of MariaDB.

mysqladmin -u root -p version

You’ll see an output similar to what shown below,

mysqladmin Ver 9.1 Distrib 10.3.13-MariaDB, for Linux on x86_64
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Server version 10.3.13-MariaDB
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /var/lib/mysql/mysql.sock
Uptime: 35 sec

Threads: 7 Questions: 16 Slow queries: 0 Opens: 18 Flush tables: 1 Open tables: 12 Queries per second avg: 0.457

Conclusion

We’ve successfully installed and secured MariaDB on your CentOS 7 server. If you have any questions, please feel free contact our technical support.