Installing MySQL Server and PhpMyAdmin On VPS CentOS

1
51

As per my last Post, for Hosting Website on VPS CentOS. Today we are going to Continue on that topic and install My SQL and PHPMyAdmin on that server.

If you haven’t read last Post for Hosting website you can visit, By Clicking Here .

Now i am continuing with my Current Topic.

Install MySQL Server

Firstly, Install My SQL Server
yum install mysql-server
My SQL server has been installed. Now, start My SQL Service.
service mysqld start
Setup My SQL root Password and Security
mysql_secure_installation

Now, Your My SQL Server has been installed and configured.

Install phpMyAdmin

To manage My SQL Server, We need to install phpMyAdmin.

phpMyAdmin package are not present in CentOS default repository. So, We will be adding EPEL repos in which phpMyAdmin packages are present.

We can add EPL repositories by running fallowing command
yum install epel-release
Now we can install phpMyAdmin repositories
yum install phpmyadmin
phpMyAdmin is now installed,

Configure Configuration file of phpMyAdmin

Default configuration file of phpMyAdmin allows access from same system only i.e. phpMyAdmin page can only be accessed on your VPS Only and not from your local system(Home computer) browser.
So, to access phpyAdmin page from your local system, you need to add your local system IP to phpMyAdmin Configuration file on server.

Open phpMyAdmin Configuration file with your favorite editor
vi /etc/httpd/conf.d/phpMyAdmin.conf
Add fallowing line in <RequireAny> section of <IfModule mod_authz_core.c>
Require ip YourLocalSystemIP
and fallowing line in <IfModule !mod_authz_core.c>
Allow from YourLocalSystemIP

Save and close configuration file and the restart Apache Server
systemctl restart httpd.service

NOTE: If your local system IP Address changes then you will not be able to access phpMyAdmin on your local system and to fix the issue you need to repeat configure Configuration file of phpMyAdmin process.
If you want to get rid of process configure Configuration file of phpMyAdmin and open phpMyAdmin page on all IP Address then replace below code section in your phpMyAdmin configuration file and it will be all.

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

<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
#ADD following line:
Require all granted
Require ip 127.0.0.1
Require ip ::1
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
#CHANGE following 2 lines:
Order Allow,Deny
Allow from All
Allow from 127.0.0.1
Allow from ::1
</IfModule>
</Directory>

Access phpMyAdmin from your Local System

You can access phpMyAdmin with fallowing URL
http://ServerIPAddress/phpMyAdmin

To logging in your phpMyAdmin you need to use username and password you created while installing MySql Server

That’s all you need for installing and configuring MySQL Server and PhpMyAdmin on CentOS server.

If this post was helpful, do like and share it. Thanks.