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.
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:
First:
Then edit root's .my.cnf file:
Make sure to
chmod 0600 .my.cnf
.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.
Yes, less passwords can be a good thing. But don't just open the database for everybody.
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.
Explanatory slides: https://www.slideshare.net/ottokekalainen/less-passwords-more-security-unix-socket-authentication-and-other-mariadb-hardening-tips.
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
For 5.7.5 and earlier
* needs a DB restart (see instructions at the link) for this to take effect.
You can also do:
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?
The
IDENTIFIED VIA unix_socket
statement is only for MariaDB.For MySQL, the same is achieved by
IDENTIFIED WITH auth_socket
.Only a difference of two words, but they're really not the same.