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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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.

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
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

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
Mark BradyPrincipal 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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
LeighJorAuthor Commented:
Thanks Elvin66. Did as you suggested alli is well. I acn smile again.
Mark BradyPrincipal Data EngineerCommented:
You're most welcome!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.