Creating a user name & password my sql
Posted by: Isreal (---.nycmny.fios.verizon.net)
Date: June 02, 2013 06:10PM

hello


Newbe question. I download wamp server and I need to set up a user name & password for my sql. When installing wamp server believing my sql should have also been installed with it. Can some one assist me with a tutorial where I can set up a user name and password for my sql. I would like to get my sql up and running correctly. Thank you Isreal.

Options: ReplyQuote
Re: Creating a user name & password my sql
Posted by: RiggsFolly (---.as13285.net)
Date: June 02, 2013 11:22PM

1. MySQL is delivered in a default state, in this state it only has one User defined, that user is 'root' and it has No password defined. It looks like there are actually 3 'root' users when you view users with phpMyAdmin, but its actually one user that is allowed to login from 3 locations i.e. ip address's localhost, 127.0.0.1 and ::1 and localhost.

2. It is very insecure to leave it in that state as everybody knows what your superuser accounts userid and password is, so people use phpMyAdmin to change one or hopefully all the 3 'root' users password.

This all goes smoothly until they try to go back to phpMyAdmin to create there first database. Now they cannot get in as the root user has a password but they have forgotten to tell the phpMyAdmin application what that new password is.

phpMyAdmin is in fact just a php application. In order for it to gain access to the mysql system it needs a userid and password. It is configured by default to expect the default state of mysql i.e. a user account called 'root' with no password.


So what you have to do is edit the phpMyAdmin config file to inform it what the new password is. To do this you edit c:\wamp\apps\phpmyadmin3.x.y\config.inc.php

The normal instruction is to change these parameters like this:
From:
This says the userid to use is 'root', there is no password, and you are aloowed to use a userid without a password
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['AllowNoPassword'] = true;

To:
This says the userid is 'root', the password is 'whatever you created as a password', and stops phpMyAdmin allowing the user of userids with no password.
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'your new password';
$cfg['Servers'][$i]['AllowNoPassword'] = false;


My personal preference is to use these parameters instead:

$cfg['Servers'][$i]['auth_type'] = 'http';
$cfg['Servers'][$i]['user'] = '';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['AllowNoPassword'] = false;

This makes phpMyAdmin throw a userid/password challenge dialog every time you try to login.
You would use root as the userid and 'the password you setup' as the password.

I think this is even more secure as even if someone has access to your PC they cannot edit this file to see your super user password, as it is not actually recorded. It does mean you have to rememer it as once forgotten you are into a whole heep of hassle to get back into mysql.

Options: ReplyQuote


Sorry, only registered users may post in this forum.