How to install phpMyAdmin?

phpMyAdminIf you read this post I think you know why you need it :) . It’s free easy to use MySQL database administration tool and it is also written in PHP like Prestashop system. PHP developers uses this tool very often but it also could be used by not techies.

This post is a little bit off topic but so many people use it every day and so many of them struggle if they need to install phpMyAdmin manually. Usually web hosting providers install phpMyAdmin by default so if you need to access your database with phpMyAdmin ask your system administrator for this tool.

For some reasons you may want to install it by your self. Download the latest phpMyAdmin. If you use windows I would recommend to download zip file. Extract it to directory some directory. I will use pma directory for this post. pma should look something like this screenshot:

pma directory
pma directory

Upload pma directory to your web server’s root directory with FTP client like FileZilla. Open it in your browser. The link to your pma directory should be like www.yourwebsite.tld/pma. You should see phpMyAdmin login page:

phpMyAdmin login page.
phpMyAdmin login page.

That’s all if your MySQL database is located in localhost – same server as your web server. Just enter username, password and press Go.

If your MySQL database server is located in other server you’ll need configure it. Open in your browser phpMyAdmin setup page. The link should be like: www.yourwebsite.tld/pma/setup. You will see setup page:

phpMyAdmin setup page
phpMyAdmin setup page

You should see error message: Cannot load or save configuration. Open your FTP client and create directory config inside pma directory. If you use Filezilla just go to pma directory click right mouse button and choose create directory:

Create directory
Create directory

 

Enter directory name config and press OK:

New directory
config directory

 

Now select config directory and click right button. Choose File permissions:

File permissions
File permissions

 

Set permissions to 777:

777 permissions
777 permissions

Go to www.yourwebsite.tld/pma/setup page an press New server:

New server
New server

Enter settings :

New MySQL server configuration
New MySQL server configuration

You should enter these settings:

  • Verbose name – choose the title of your server
  • Server hostname – MySQL serer host name or IP adress
  • Server port – leave it blank if your server uses default (3306). Usually you may leave this field blank
  • PHP extension to use - leave mysqli. Usually this module is installed. If you can not connect to your database try using mysql not mysqli.

Press Save. You should see your server in the list:

MySQL servers list
MySQL servers list

You can press New server and enter one more if you need. When you finish entering servers press Save at the bottom of the page near Display | Downaload buttons (look at previous image). Pressed Save button will save all configuration data you entered to the config.inc.php file in config directory.

Go to config directory and you should see config.inc.php file:

config.inc.php
config.inc.php

OK we are almost done. Now you have to copy or move config.inc.php file to pma directory. It is easy to do with filezilla - just click and drag config.inc.php to directory with the name .. (two dots) – it is an upper lever directory pma. Of course you can download this file to your computer and upload back to pma directory if you use some other FTP client and it does not have ability to move files in FTP client environment.

Now go to www.yourwebsite.tld/pma/ and if you entered more than one server you should see additional Server Choice: drop down field:

Server choise
Server choise

Note: If you entered only one server then dropdown field Server Choice: will not appear. Just enter user name, password and click Go.

If you still can not connect to your MySQL server go back to setup page and try change settings and do not forget to save new configs and move config.inc.php to pma directory again.

If you have installed Prestashop then you find all information about your database in config/settings.inc.php – it is located where your Prestashop is installed.

IMPORTANT! It is not secure to leave your phpMyAdmin like in this tutorial. You should rename pma to something like pma432a - it will be hard to guess the path to your phpMyAdmin. I would also recommend to protect pma directory with .htaccess Authentication – I will write about it in my next posts.

Updated 2011.07.02:

You may encounter one problem – tables are not displayed. You can login but you can’t do any operations with phpmyadmin. You can write these queries: “use your_database_name; show tables;” (without quotes.) This should list all the tables. If you can list all tables with this command than include this line into your config.inc.php :

$cfg['Servers'][$i]['only_db'] ='your_database_name';

Now your phpMyAdmin will use only one database but you will be able to see tables. I think this problem is caused because phpMyAdmin can not execute “Show databases;” query – your user has no privileges so you should use only one database. This method solved this problem many times for me. If you have any questions just comment here or write me an email to donatas@invertus.lt

Hope you’ll like this post and keep following us. More great tutorials are coming soon :).

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>