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.
Personally, I think instead it's better to set a password and save it in /root/.my.cnf:
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.
If you DO have a password set for MySQL, follow the instructions at Recover MySQL root Password, and then set your password to null:
For 5.7.6 and later
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass'
For 5.7.5 and earlier
update user set password=PASSWORD("") where User='root';
* needs a DB restart (see instructions at the link) for this to take effect.
sudo service mysql restart
You can also do:
grant all privileges on *.* to 'root'@'localhost' identified by '';
Yes, less passwords can be a good thing. But don't just open the database for everybody.
grant usage on *.* to 'root'@'localhost' identified via unix_socket;
This gives you passwordless mysql acces for a locally logged in root user. Btw. this is the default in recent ubuntu / debian releases.
some_user@box: mysql -u root # denied root@box: mysql # good some_user@box: sudo mysql # good, if "some_user" has sudo rights.
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 ''