Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to install/configure phpMyAdmin



OK, lemme add a bit more for phpMyAdmin, nice little program written in PHP to admin your new mysql databases..


First things first, we need to get the latest version of phpMyAdmin, at the time this tutorial was written the latest stable version was 2.5.6, and you can get it at;


The phpMyAdmin Home page


OK open a terminal/console window..


Change to the directory where you saved the downloaded file , such as;


cd /home/square/downloads  <enter>


okay, now we need to move the file to the root directory of your Apache webserver, which is usually /usr/local/apache/htdocs, also, root usually owns the Apache directory structure so you'll need to do the rest as root, so;


su  <enter>


Note: no dash needed, THIS time only.


Enter your root pass then press enter.


Now, lets move the file to where we need it;


mv phpMyAdmin-2.5.6.tar.gz /usr/local/apache/htdocs <enter>


Note: you may want to su - now to grab roots profile, if you think you'll need it.


Now make the Apache root directory your working directory;


cd /usr/local/apache/htdocs  <enter>


Now lets unpack the file;


tar -zxvf phpMyAdmin-2.5.6.tar.gz  <enter>


That will take a second, then, when the machine returns the prompt, do a directory listing;


ls  <enter>


You should see a new directory which has been created called phpMyAdmin-2.5.6, assuming you do, go ahead and get rid of the original file;


rm phpMyAdmin-2.5.6.tar.gz <enter>


Now, the new directory name is a bit long, and definatley not something you want to type in all the time, so lets make it easier;


mv phpMyAdmin-2.5.6 phpmyadmin <enter>


Cool, now you've renamed the directory to something a little easier to remember, now make that your working directory;


cd phpmyadmin <enter>





Now, what we need to do is edit the file so it works with your setup. So using vi, or whatever your favorite editor happens to be, open, find the following lines, and edit them as appropriate for your setup;



$cfg['PmaAbsoluteUri'] = ''; (Default)
$cfg['PmaAbsoluteUri'] = ''; (Edited)

$cfg['Servers'][$i]['user'] = 'root'; (Default)
$cfg['Servers'][$i]['user'] = 'your_MySQL_root_user'; (Edited)

$cfg['Servers'][$i]['password'] = ''; (Default)
$cfg['Servers'][$i]['password'] = 'your_password'; (Edited)



Thats it, save the file and close it.


Now, lets see if it works, open a browser and point it to phpMyAdmin by using your site info such as, or, localhost/phpmyadmin if you are only working locally. If all is well you should see the welcome screen for phpMyAdmin !, if you don't, then check your logs and remember, Google is your friend. If you see a page full of PHP errors, make sure you used the correct username and password when you edited the lines mentioned above.


Now, knowing what this cool program is capable of, its probably not something you want just anyone to be able to access, luckily we can take care of that very easily using Apache 's authentication process, so lets do it !


Still as root make a directory to store the password file we will be creating;


mkdir /usr/local/apache/passwd <enter>


Now, lets create the file and add an allowed user;


/usr/local/apache/bin/htpasswd -c /usr/local/apache/passwd/authpass myphp <enter>


htpasswd will prompt you for the password you would like to assign to this user, once entered, it will create the file authpass and populate it with the information for the user called myphp. You can use whatever names you like, this is only an example.


Now the final step, change to your Apache configuration directory;


cd /usr/local/apache/conf <enter>


And again using your favorite editor, open the file named httpd.conf and find the following section;


<Directory />
  Options FollowSymLinks
  AllowOverride None


Directly under this section add the following (assuming you used the names from the example above);

<Directory "/usr/local/apache/htdocs/phpmyadmin">
  AuthType Basic
  AuthName "myphp"
  AuthUserFile /usr/local/apache/passwd/authpass
  Require user myphp


Thats it, save the file and close it, then restart Apache by issuing the following command;


/usr/local/apache/bin/apachectl restart <enter>


Perfect, now fire up your browser again and point it back to your phpMyAdmin site, this time you should be prompted for a username and password before being allowed access to the site. Enter the required information, and you are in business !.


That brings us to the end of this tutorial, hopefully you found this information helpful, and Good Luck !






Thanks for this post. It worked like a charm!
Just ensure that it's not bound to your default virutal host, nor accessible via general sniffing - there's loads of bots out there trying to exploit flaws in phpmyadmin!

This tutorial is very useful.


Help me setup "phpMyAdmin-" ? What all are the things i want to configure here ?


Normaly file name is "". Am i want to change it as "" ?


I could not find following lines


$cfg['PmaAbsoluteUri'] = ''; (Default)

$cfg['PmaAbsoluteUri'] = ''; (Edited)


Firstly, that post was made back in 2004, and a number of things have changed since then. In particular, phpmyadmin is now in many repos so using distro-specific installers (rpm, yum, apt) will pull down and install the requisite files - you don't need to download and extract a tarball anymore.


(this doesn't mean you shouldn't - just that the distro-specific build does all the apache configs and other stuff for you, and is easier to install)


Secondly, you're supposed to make a copy "" to "" then change it to suit your own needs. Rename it if you wish, but it's a good idea to keep a copy of the original so you can refer back to any content prior to your changes.


Thirdly.. those lines that appear missing may have changed in the config file - I know some new directives and parameters appeared between versions which caught me out one time. The config file should be well-commented to guide you as to what to change.


Hope that helps! What distro is it you're using?


Forum Jump:

Users browsing this thread: 1 Guest(s)