How can I delete my password for MySQL? I dont want to have a password to connect to the database. My server is running Ubuntu.

link|improve this question

Just as a matter of interest, why don't you want a password? – John Gardeniers May 20 '10 at 2:31
feedback

3 Answers

up vote 5 down vote accepted

Personally, I think instead it's better to set a password and save it in /root/.my.cnf:

First:

mysqladmin -u root password 'asdfghjkl'

Then edit root's .my.cnf file:

[client]
password = asdfghjkl

Now you have a password but you're no longer prompted for it. My default MySQL server install is a totally random unique password for each MySQL server, saved in the .my.cnf file like this.

link|improve this answer
1  
I strongly agree with the setting your environment to automatically authenticate you vs removing the password. – Zoredache May 19 '10 at 23:37
1  
You may need quotes around that password in the .my.cnf. It didn't work for me without. – user67641 Mar 12 '11 at 21:07
@user67641: Might depend on version and what's in your password... Mine are all long random strings of alphanumerics (no special characters) and haven't needed quotes. – freiheit Mar 12 '11 at 21:09
feedback

If you DO have a password set for MySQL, follow the instructions at Recover MySQL root Password, and then set your password to null:

update user set password=PASSWORD("") where User='root';
link|improve this answer
Thanks for all answers! – Yosef May 19 '10 at 22:46
in this case, dont forget to "flush privileges;" – Marco Ramos May 19 '10 at 22:51
@meyosef - please mark an answer as answered if it solved your problem (click on the green checkmark under the number of votes). – jneves May 19 '10 at 22:52
Thank again!really helps me – Yosef May 21 '10 at 13:21
feedback

I'm pretty sure that by default there is no password if your the admin user and accessing it locally. Are you finding something different than that?

Does this work?

#> mysqladmin -u root password ''
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.