Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to configure config.inc.php to have a loginform in phpmyadmin

Tags:

phpmyadmin

Do I have to download any files in order to have a login form in php. I've asked this a million times but I'm not sure if you guys gets the question or not. All I want is a login form In phpmyadmin. Wherein you will input your username and password. DO I have to create any php login form or is it already included when you install wampserver. I've already configured the config.inc.php in C:\wamp\apps\phpmyadmin3.2.0.1 . Here is what it looks like when I don't include any password. What do I have to edit? I'm beginner and so eager to have that login form already but I don't get any relevant answers.

<?php

    /* Servers configuration */
    $i = 0;

    /* Server: localhost [1] */
    $i++;
    $cfg['Servers'][$i]['verbose'] = 'localhost';
    $cfg['Servers'][$i]['host'] = 'localhost';
    $cfg['Servers'][$i]['port'] = '';
    $cfg['Servers'][$i]['socket'] = '';
    $cfg['Servers'][$i]['connect_type'] = 'tcp';
    $cfg['Servers'][$i]['extension'] = 'mysqli';
    $cfg['Servers'][$i]['auth_type'] = 'config';
    $cfg['Servers'][$i]['user'] = 'root';
    $cfg['Servers'][$i]['password'] = '';
    $cfg['Servers'][$i]['AllowNoPassword'] = true;

    /* End of servers configuration */

    $cfg['DefaultLang'] = 'en-utf-8';
    $cfg['ServerDefault'] = 1;
    $cfg['UploadDir'] = '';
    $cfg['SaveDir'] = '';

    ?>
like image 898
user225269 Avatar asked Feb 26 '10 12:02

user225269


People also ask

Where is config Inc PHP in phpMyAdmin?

The configuration files are located in the /etc/phpmyadmin directory. The main configuration file is /etc/phpmyadmin/config. inc. php, which contains the configuration options that apply globally to phpMyAdmin.

Where is config inc php file in xampp?

The file is config. inc. php of XAMPP located in /opt/lampp/phpmyadmin .

Where does phpMyAdmin store passwords?

phpMyAdmin is a front-end for MySQL, so we're talking about MySQL users. In MySQL, users and their password are stored in a database called "mysql".

What is username and password in phpMyAdmin?

Log in to phpMyAdmin by using the following credentials: Username: root. Password: The same as the application password.


2 Answers

First of all, you do not have to develop any form yourself : phpMyAdmin, depending on its configuration (i.e. config.inc.php) will display an identification form, asking for a login and password.

To get that form, you should not use :

$cfg['Servers'][$i]['auth_type'] = 'config';

But you should use :

$cfg['Servers'][$i]['auth_type'] = 'cookie';

(At least, that's what I have on a server which prompts for login/password, using a form)


For more informations, you can take a look at the documentation :

  • Using authentication modes
  • Configuration, which states (quoting) :

'config' authentication ($auth_type = 'config') is the plain old way: username and password are stored in config.inc.php.

'cookie' authentication mode ($auth_type = 'cookie') as introduced in 2.2.3 allows you to log in as any valid MySQL user with the help of cookies.
Username and password are stored in cookies during the session and password is deleted when it ends.

like image 115
Pascal MARTIN Avatar answered Oct 27 '22 03:10

Pascal MARTIN


$cfg['Servers'][$i]['auth_type'] = 'cookie';

should work.

From the manual:

auth_type = 'cookie' prompts for a MySQL username and password in a friendly HTML form. This is also the only way by which one can log in to an arbitrary server (if $cfg['AllowArbitraryServer'] is enabled). Cookie is good for most installations (default in pma 3.1+), it provides security over config and allows multiple users to use the same phpMyAdmin installation. For IIS users, cookie is often easier to configure than http.

like image 39
Pekka Avatar answered Oct 27 '22 04:10

Pekka