Install and configure phpMyAdmin on IIS

Categories:


Creating your phpMyAdmin MySQL user account

Here we'll create the MySQL user account used by phpMyAdmin to perform many of its administrative functions. Simply log into your new phpMyAdmin install using the root account, click on the SQL query window button in the row of buttons in the top left hand side and then enter this query;

CREATE USER 'pma'@'localhost' IDENTIFIED BY 'your_password';

Click the Go button and it will create a new user for you. Obviously you'd need to change the "your_password" string to the same as what you have specified in you phpMyAdmin configuration file in the steps above. Next step is to assign the privileges to the phpMyAdmin user on the MySQL database. To do this, copy and paste the following code into the SQL query window. Be sure to delete the previous query first and change the "your_password" string again;

GRANT USAGE ON mysql.* TO 'pma'@'localhost' IDENTIFIED BY 'your_password';
GRANT SELECT (
    Host, User, Select_priv, Insert_priv, Update_priv, Delete_priv,
    Create_priv, Drop_priv, Reload_priv, Shutdown_priv, Process_priv,
    File_priv, Grant_priv, References_priv, Index_priv, Alter_priv,
    Show_db_priv, Super_priv, Create_tmp_table_priv, Lock_tables_priv,
    Execute_priv, Repl_slave_priv, Repl_client_priv
    ) ON mysql.user TO 'pma'@'localhost';
GRANT SELECT ON mysql.db TO 'pma'@'localhost';
GRANT SELECT ON mysql.host TO 'pma'@'localhost';
GRANT SELECT (Host, Db, User, Table_name, Table_priv, Column_priv)
    ON mysql.tables_priv TO 'pma'@'localhost';

If the query was successful, then you can now close the query window down.

Creating and populating your phpMyAdmin MySQL database

Almost there now! The last thing to do before your phpMyAdmin installation is complete is to import the phpMyAdmin SQL script. However before we do that we'll need to uncomment a few lines so that the correct privileges are created for the phpMyAdmin MySQL user account. Navigate to the scripts directory in your phpMyAdmin root directory, and open the file called "create_tables_mysql_4_1_2+.sql". Scroll down to the section pertaining privileges which should be all commented out and remove the double hyphens (--) from infront of lines 36 and 37. This section should end up with something looking like this;

GRANT SELECT, INSERT, DELETE, UPDATE ON `phpmyadmin`.* TO
   'pma'@localhost;

Save the file, then again in your phpMyAdmin window click on the Home button in the group of buttons in the top left hand side of the screen, and then click on the Import link in the right hand frame towards the bottom of the screen. Once this window opens, click on the Browse button and navigate to the "create_tables_mysql_4_1_2+.sql" file in the scripts directory of your phpMyAdmin install and click the Go button. This browse function only displays local files, so if you phpMyAdmin install is located on a different machine then you'll need to copy the "create_tables_mysql_4_1_2+.sql" file down locally and import it from there.

All Done

That is it! Your phpMyAdmin installation is now complete, and you should now have one of the most powerful MySQL administration tools around at your fingertips ready to use. One last bit of advice I will give is when creating users through phpMyAdmin, be sure to select the "Grant all privileges on wildcard name (username\_%)" option. What this basically does is give administrative privileges to users for the databases that are prefixed with their username, which is a very handy function in a multi user environment. Other than that it is also very highly recommended that you secure your phpMyAdmin installation by using SSL, and I will cover this in a guide later on down the track. If you have any feedback, please feel to leave a comment or post in the forum.

Comments

Anonymous's picture

Very helpful

I just got phpMyAdmin installed perfectly following your guide .. & I just wanted to thank you .. So,

Thank You ..

Brashquido's picture

Thanks for the comment.

Thanks for the comment. Happy the guide was able to help out!
----------------
Dominic Ryan
3 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster

Anonymous's picture

Can't seem to get this working

Hi,

First of all i would like to say that this tutorial is one of the most detailed ones I've come across...
I tried many tutorials and finally tried yours...

I've got the MySQL and PHP running... No probs there.
But when I unzip the phpmyadmin to a folder, make the changes to the config file and try to open the site. the troubles start...

Sometimes it opens, sometimes it doesn't. It also doesn't show the nice colors it normally has.
When I give in the credentials for the MySQL it tries to login... but no effect. It seems to hang or gives me the page not found error. After I got this error The site doesn't load at all. I need to reboot the IIS to get back some action...

I downloaded and installed:
mysql-essential-5.0.45-win32.msi
php-5.2.4-Win32.zip
pecl-5.2.4-Win32.zip
phpMyAdmin-2.11.1.1-all-languages.zip

I also have ActivePerl installed... maybe that's the "badass"?

This all I've got installed on a clean W2K3 Server machine with all updates, .NET Frameworks and IIS notging more...

Do you have any idea?

Thanx

Brashquido's picture

Sounds like a permissions

Sounds like a permissions issue to me, maybe something to do with your PHP environment. Sorry I don't have an answer off the top of my head, so it looks like we're going to have to do some digging. Things I would check are;

- Event Viewer
- PHP Log
- IIS Log files

----------------
Dominic Ryan
3 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster

Anonymous's picture

Thank You for your quick reply

I checked the Event Viewer and this it wat it said:

2 errors eventid 2214 and 2268
2214 says it can't load the php_mysql.dll
2268 says it can't load all the isapi filters

I'm not sure where to find the PHP log or the IIS log...

But i know i need to do something about the 2 errors I mentioned before.
Not sure how to fix it.
I'll keep you posted.

Thanx a lot for the help already :-)

Kindest regards,

Stijn

Brashquido's picture

Ok, first thing I would be

Ok, first thing I would be doing is double checking the extension_dir directive in php.ini, and perhaps try entering the absolute path if you haven't done so already. Also make sure you only have the bare essential PECL extensions loaded (as described in the guide) until this is sorted.

Your php log is defined in your php.ini file, and your IIS log files are located by default in %windir%\system32\logfiles
----------------
Dominic Ryan
3 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster

Anonymous's picture

It Works !

Thanx a lot for the help.
I completely uninstalled PHP and reinstalled PHP.
PHPMyadmin afterwards wasn't a problem anymore.

Great help, good tutorial.

Thank you,

Kindest regards,

Stijn

Brashquido's picture

Thanks for notifying me

Thanks for notifying me yeutragop. Should be fixed now.
----------------
Dominic Ryan
4 x Microsoft IIS MVP, MCSE, MCSA
IIS Aid owner/webmaster

yeutragop's picture

The Tutorial is no longer

The Tutorial is no longer there can some one please repost it thanks so much for your time

Best Regards,

yeutragop

Anonymous's picture

help im lost

this is it i can figure out everything installed but i cant get to myadmin. im new to server but not to the program. i can see phpinfo but when i got php myadmin i get Cannot start session without errors, please check errors given in your PHP and/or webserver log file and configure your PHP installation properly. im not sure about the logs either.please in you can help me. other than that i love ur guieds there great.