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
config.inc.php.

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:

<?php
$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?

LVL 1
gwh2Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

UmeshSenior Principal 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;
 
$i++;
$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

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
gwh2Author Commented:
Thanks for the solution
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.