Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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.

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

4 Answers 4

up vote 9 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.

share|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

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';
share|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

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 ''
share|improve this answer

You can also do:

grant all privileges on *.* to 'root'@'localhost' identified by '';
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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