how to set root password ?
Posted by: Ashvini (---.live.vodafone.in)
Date: January 31, 2013 08:52AM

How to set root user password , and access with password ?

Options: ReplyQuote
Re: how to set root password ?
Posted by: RiggsFolly (---.as13285.net)
Date: January 31, 2013 12:43PM

Please read the whole post before starting this process. Mistakes can cause untold hassle.


The MySQL server out of the box has one userid setup, userid=root and password=[nothing] i.e. blank password.

Now phpMyAdmin's default config expect 'root' to have a blank password so there are a few things to do here in the correct order so that you dont lock yourself out of phpMyAdmin.


Open phpMyAdmin.
Click the 'Users' menu on the top row.
Click [Edit Privileges] on one of the root users i.e. [root localhost]
Scroll down to the section called 'Change Password'
Click the 'Password' radio button.
Enter your required password in both fields provided.
MAKE A NOTE OF THIS NEW PASSWORD SOMEWHERE AND DONT LOOSE IT!!!!!!
Press the 'Go' button.
Do this for all 3 'root' userid entries that exists in the users list.


Having added a password to the 'root' userid, phpMyAdmin will now no longer sign on as it expects the password to be blank.
So we now have to edit the following file:-

[x]:\wamp\apps\phpmyadminX.Y.Z\config.inc.php

Option 1:
Add the new password to the config

change:
$cfg['Servers'][$i]['password'] = ''
TO
$cfg['Servers'][$i]['password'] = 'your new password'

change:
$cfg['Servers'][$i]['AllowNoPassword'] = true;
TO
$cfg['Servers'][$i]['AllowNoPassword'] = false;

add this line to make exiting phpMyAdmin return to a clean url instead of giving an error message
$cfg['Servers'][$i]['LogoutURL'] = 'http://localhost/';



Option 2: ( more secure, people who have access to your PC cannot read the root password from the config file )
Makes the browser throw a userid/password challenge dialog at login

Change
$cfg['Servers'][$i]['user'] = 'root';
TO
$cfg['Servers'][$i]['user'] = '';

leave this line as it is
$cfg['Servers'][$i]['password'] = ''

change:
$cfg['Servers'][$i]['AllowNoPassword'] = true;
TO
$cfg['Servers'][$i]['AllowNoPassword'] = false;

change:
$cfg['Servers'][$i]['auth_type'] = 'config';
TO
$cfg['Servers'][$i]['auth_type'] = 'http';

add this line to make exiting phpMyAdmin return to a clean url instead of giving an error message
$cfg['Servers'][$i]['LogoutURL'] = 'http://localhost/';


In my opinion Option 2 is a better option. Your browser will ask for the userid and password each time you login. This does depend on you not forgetting the password though.

Options: ReplyQuote


Sorry, only registered users may post in this forum.