Setting up mysql password in wampserver2 environ

I think it used to be easier before they packaged evrything together. Anyway how do I setup password for root in mysql. I do the privileges thing and set password there. Wherer do I  find the right .inc file. Please help a grumpy old man. THanks in advance.
Who is Participating?
Mark BradyConnect With a Mentor Principal Data EngineerCommented:
Depends of it it is a local server on your machine and NOT a public server. If it is public then yes you MUST set a good password for root. Can you open phpmyadmin ? If so, go in there and up the top you see an 'SQL' link. click on that and you can type commands directly into the window so follow the instructions I sent you for that.

As for your web pages/scripts connecting to your mysql. I have many different databases that I use but I have the same user and password for them so when you setup a new database, you will need to assign a username and a password to connect to it. That is what you put into your php scripts to connect to that particular DB.

Sorry if I'm talking to much. If you just need to set the root then do as I posted initially
Mark BradyPrincipal Data EngineerCommented:
Here is how to do it. Let me know how you go. I know I had to do it when I setup Wampserver but it worked great!
LeighJorAuthor Commented:
Using Win7. I want to know which othere files need changing . the file kept?
As i understand it i must change the pwd through mysql console and then configure    file so as phpmyadmin is aware  of wahts going on .Helppp.

Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

Mark BradyPrincipal Data EngineerCommented:
I'm not sure you are correct about that. I never changed any inc or ini file. Just go into phpmyadmin and you can type directly into the mysql console to set the root password. When you setup/install wampserver it should ask you to set a password but if you missed that step then you can set it anytime.

When you first set it up the default username and password is
user: root
pass: ''      or blank - no password
LeighJorAuthor Commented:
You may  be right but what is the file for:

/* Servers configuration */
$i = 0;

/* Server: localhost [1] */
$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'] = '';


Open in new window

Mark BradyPrincipal Data EngineerCommented:
I am not 100% certain but my guess is that mysql will modify that file when you change the password etc.... I don't think it is meant to be mucked with by the user. I could be wrong but I certainly didn't have to modify any files. Try my way first and see how it works.
LeighJorAuthor Commented:
Yes you are right elvin66 ! When I open database though and go to privileges root is not assigned pwd. Does that mean my db is still insecure. I have set the root pwd to 'abc' how you suggested. But to connect to my db with php would I need connect "dbname,localhost,root,"abc"" or without pwd. Cheers
LeighJorAuthor Commented:
Thanks Elvin66. Did as you suggested alli is well. I acn smile again.
Mark BradyPrincipal Data EngineerCommented:
You're most welcome!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.