• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3762
  • Last Modified:

config.inc.php file for phpMyAdmin

Hi everyone,

I'm working my way through a book in order to try and set up a php/apache/mysql testing environment on my mac computer. I've downloaded MAMP to get it going (even though the book uses separate php mysql etc components, as opposed to MAMP).

The book is saying that phpMyAdmin uses a text file to store all the configuration
details and that since version 2.7.0, you no longer edit the phpMyAdmin configuration file
but store your personal details in a new file, which should be named

After I installed MAMP I did a search on my computer for the config.inc.php file and found it at this location:

Applications > MAMP > bin > phpMyAdmin > config.inc.php

When I opened this file, I noticed that it has over 700 lines of code and information. I'm a bit confused because the book provides instructions on how to create this file manually. It says to type the following code into a blank document:

$i = 1;
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['password'] = 'mysqlRootPassword';

Then to save the file as config.inc.php in the main phpMyAdmin folder. I don't understand why I have to create this new config file with just that bit of code when this file already exists but with a whole lot more code and information.

Can someone explain how this works?

1 Solution
UmeshMySQL Principle Technical Support EngineerCommented:
If your phpmyadmin folder does not have config.inc.php file then just create it(no need to create if it already exists).

And make sure you set these settings properly ( // at the end)

$cfg['Servers'][$i]['auth_type'] = ''; -- dictates the authentication method used when connecting to your phpMyAdmin installation.

    The three options for authentication are:

        * config (the default method)
        * http
        * cookie (recommended method)

    config method - This method is the least secure, as it requires storing your MySQL username and password in the file on the server. Anyone who would find the directory to your phpMyadmin installation would then be able to access your databases. This is the default method, however. *See important note.

    http or cookie authentication methods - These methods are more secure, as your username and password are not stored on the server in your configuration file.

/* Servers configuration */
$i = 0;
$cfg['Servers'][$i]['host'] = 'localhost'; //
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['port'] = '3306'; //
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['auth_type'] = 'config'; // 
$cfg['Servers'][$i]['user'] = 'root'; //
$cfg['Servers'][$i]['password'] = 'your password'; //

Open in new window

gwh2Author Commented:
Thanks for the solution
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

Tackle projects and never again get stuck behind a technical roadblock.
Join Now