INSTALL and setup PHPMYADMIN MySQL software on CentOS server running Apache (LAMP) – I keep figuring what’s the next tutorials should be until then I contacted by one of my readers asking me how to install PhpMyAdmin. So here it is the tutorial to guide you how to install PhpMyAdmin on a CentOS server running
LAMP stack (Linux, Apache, MySQL, PHP). However I assume by following
this tutorial you have already had a server with LAMP stack installed,
configured and running properly. Otherwise simply follow my previous guide how to set it up or here for installing LAMP with PHP 5.5 and MySQL v5.5.32.
Before you proceed to the next steps, it is better to explain that all commands in this tutorial are written without the “sudo” prefix. However if you disabled root login and you logged in using another username with root privilege, you can add the “sudo” prefix all by your self. Alternatively you can simply type su, hit Enter and type in your password twice to switch login as root. You may also need to type this command to go to the root directory:
Step 2 – Install PhpMyAdmin via yum using this command:
pic:
p.s: Optional – You better firstly issue “yum update -y” and “yum upgrade -y” before running above command just to make sure yum is updated.
Step 3 – So the you’ve installed PhpMyAdmin but you may also firstly need to edit Apache configuration before using it. Edit phpmyadmin.conf file:
Step 4 – Its main content will look like this;
Now you’ll need to comment (add # symbol)
starting from <Directory “/usr/share/phpmyadmin”> till the
</Directory> line. This is aimed to change the Apache
configuration so that phpMyAdmin allows connections not just from
localhost. At the end it should look like this:
Now save (Control+O) then exit Nano editor (Control+X).
Step 5 – This step is optional, changing how the way you login to PhpMyAdmin from “cookie”-based authentication to “http”. Edit PhpMyAdmin configuration file (config.inc.php):
then look for the line that says:
now replace ‘cookie’ with ‘http’
screenshot:
Once done, save it then exit Nano editor.
Step 6 – Finally, restart Apache and MySQL:
and
pic:
http://your.ip.address/phpmyadmin
or
http://yourdomain.tld/phpmyadmin
Your browser should directly prompt you to enter username and password. You can simply use root as username and enter its password. Remember, the password is the MySQL root password not your server root password. You can also use any other MySQL username and password if you have created one. Read top most common MySQL basic commands.
What you’ll need?
- This guide is done in a CentOS 6.4 x86_64 VPS (as always by DigitalOcean). Hence, you’ll need a CentOS server. However you can still follow the tutorial by adjusting some commands if you are using any other Linux Distros.
- I also assumed you knew already how to use Putty or Terminal to SSH-ing a server.
- I believe you knew –at least part of– most common Unix commands used to manage an unmanaged server.
How To Install PHPMYADMIN
Step 1 – Login to your server and follow my previous guide about Basic setup for CentOS before you build a live web server. You may and may not follow that tutorial but if you followed, it will give you some basic security tweak to your server.Before you proceed to the next steps, it is better to explain that all commands in this tutorial are written without the “sudo” prefix. However if you disabled root login and you logged in using another username with root privilege, you can add the “sudo” prefix all by your self. Alternatively you can simply type su, hit Enter and type in your password twice to switch login as root. You may also need to type this command to go to the root directory:
1
| cd ~ |
1
| yum install phpmyadmin -y |
p.s: Optional – You better firstly issue “yum update -y” and “yum upgrade -y” before running above command just to make sure yum is updated.
Step 3 – So the you’ve installed PhpMyAdmin but you may also firstly need to edit Apache configuration before using it. Edit phpmyadmin.conf file:
1
| nano /etc/httpd/conf .d /phpmyadmin .conf |
1
2
3
4
5
6
7
8
9
10
11
12
| # Web application to manage MySQL # <Directory "/usr/share/phpmyadmin" > Order Deny,Allow Deny from all Allow from 127.0.0.1 < /Directory > Alias /phpmyadmin /usr/share/phpmyadmin Alias /phpMyAdmin /usr/share/phpmyadmin Alias /mysqladmin /usr/share/phpmyadmin |
Now save (Control+O) then exit Nano editor (Control+X).
Step 5 – This step is optional, changing how the way you login to PhpMyAdmin from “cookie”-based authentication to “http”. Edit PhpMyAdmin configuration file (config.inc.php):
1
| nano /usr/share/phpmyadmin/config .inc.php |
1
| $cfg[ 'Servers' ][$i][ 'auth_type' ] = 'cookie' ; |
1
| $cfg[ 'Servers' ][$i][ 'auth_type' ] = 'http' ; |
Once done, save it then exit Nano editor.
Step 6 – Finally, restart Apache and MySQL:
1
| service httpd restart |
1
| service mysqld restart |
Access and Login PHPMYADMIN
You can access PhpMyAdmin in your browser via:http://your.ip.address/phpmyadmin
or
http://yourdomain.tld/phpmyadmin
Your browser should directly prompt you to enter username and password. You can simply use root as username and enter its password. Remember, the password is the MySQL root password not your server root password. You can also use any other MySQL username and password if you have created one. Read top most common MySQL basic commands.
No comments:
Post a Comment