[SOLVED] Ask for Username and Password in phpMyAdmin

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

[SOLVED] Ask for Username and Password in phpMyAdmin

Post by anjanesh »

I have phpMyAdmin setup alright but the url is like http://www.xxx.com/phpMyAdmin
This automatically connects to the database with username and password - thats because its set in config.inc.php.
Any way to have it ask for username and password ?
Thanks
Last edited by anjanesh on Sun Mar 27, 2005 11:18 am, edited 1 time in total.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Not that I'm aware of... it's open source though so probably not too difficult to implement :)
User avatar
neophyte
DevNet Resident
Posts: 1537
Joined: Tue Jan 20, 2004 4:58 pm
Location: Minnesota

Post by neophyte »

Just create .htaccess and a .htpassword file. That will protect the entire directory. Read more here.

http://www.2020dns-hosting.net/help/access.html
Sphen001
Forum Contributor
Posts: 107
Joined: Thu Mar 10, 2005 12:24 pm
Location: Land of the Beaver

Post by Sphen001 »

Well, I know there is a way to force phpMyAdmin to ask for passwords. I think it has something to do with the config file. There should be some info in the manual.

Also, I wouldn't recommend .htaccess because it could get really difficult to maintain. Better stick with the built in authentication.

Sphen
User avatar
neophyte
DevNet Resident
Posts: 1537
Joined: Tue Jan 20, 2004 4:58 pm
Location: Minnesota

Post by neophyte »

I'm really curious now because I've never heard of phpmyadmin having any sort of a user system. Do they? Anyone know for sure. Because I've only seen it with an external user system or .htaccess. That'd be great if they do...
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

I could not find anything in config.inc.php regarding this.
There is a $cfg['Servers'][$i]['password'] = "mypassword" where if I have it null $cfg['Servers'][$i]['password'] = "", it'll say access denied because not using password etc.
The only other thing I found in config.inc.php was this :

Code: Select all

/**
 * If you wish to use the SQL Validator service, you should be
 * aware of the following:
 * All SQL statements are stored anonymously for statistical purposes.
 * Mimer SQL Validator, Copyright 2002 Upright Database Technology.
 * All rights reserved.
 */
$cfgї'SQLValidator']ї'use']      = FALSE;   // Make the SQL Validator available
$cfgї'SQLValidator']ї'username'] = '';      // If you have a custom username, specify it here (defaults to anonymous)
$cfgї'SQLValidator']ї'password'] = '';      // Password for username
Before I change anything, what is this SQL Validator service ?
Thanks
Sphen001
Forum Contributor
Posts: 107
Joined: Thu Mar 10, 2005 12:24 pm
Location: Land of the Beaver

Post by Sphen001 »

Hmm...

Well, I've seen phpMyAdmin screens where I have had to enter my username and password before I could access it. Maybe I'm mistaken. I'll go take a look over at the site and see what I can dig up. :D

Sphen
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

You do require a password is the default username does not contain a password.
It requires some sort of validation or anyone would have access to your machines db 8)

I believe, not too sure though.
Last edited by John Cartwright on Sun Mar 27, 2005 11:08 am, edited 1 time in total.
Sphen001
Forum Contributor
Posts: 107
Joined: Thu Mar 10, 2005 12:24 pm
Location: Land of the Beaver

Post by Sphen001 »

Okay, well I found this docs page.

Maybe it was the cookie auth method I was thinking about...

Sphen
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

$cfgї'Servers']ї$i]ї'auth_type']     = 'http';                         // Authentication method (config, http or cookie based)?
$cfgї'Servers']ї$i]ї'user']          = 'your mysql username';          // MySQL user
$cfgї'Servers']ї$i]ї'password']      = 'your mysql password';          // MySQL password (only needed
User avatar
neophyte
DevNet Resident
Posts: 1537
Joined: Tue Jan 20, 2004 4:58 pm
Location: Minnesota

Post by neophyte »

Unless you're going to have a lot of people accessing phpmyadmin. I don't think anything more than .htaccess is necessary.htaccess will allow you to set up multiple users too.
User avatar
neophyte
DevNet Resident
Posts: 1537
Joined: Tue Jan 20, 2004 4:58 pm
Location: Minnesota

Post by neophyte »

The mighty feyd is here on easter to rescue us from our ignorance. :wink:
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

Feyd : Thank you very much.
neophyte wrote:The mighty feyd is here on easter to rescue us from our ignorance
He already has answerd it - and I wonder how he manages to get all answers so quickly.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I wonder how he manages to get all answers so quickly.
Most times, I've gone through or know enough about a subject to figure it out real fast. Part of the reason I charge what I do for work ;) I seem to have a really good memory about code for some reason. I have horrid memory pretty much everywhere else though :lol:

This particular instance, I've gone through and figured out how phpMyAdmin is configured for it previously. Reading the docs helps :P
Post Reply