FreeKB - mySQL / MariaDB passwordless authentication
mySQL / MariaDB - passwordless authentication

In this example, passwordless authentication will be configured for root. Issue the following command.

mysqladmin -u root -p password 'abc123'


Create root's hidden .my.cnf file.

touch /root/.my.cnf


Update root's hidden .my.cnf file so that only root and read/write the file.

chmod 0600 /root/.my.cnf


Append the following to root's hidden .my.cnf file.

password = abc123


You should now be able to connect ot mySQL / MariaDB as root without a password.

mysql -u root


Additionally, you will be able to issue mySQL commands on the command line with the -e option without providing root's password.

mysql -e "show databases;"


Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

Please enter 862ad in the box below so that we can be sure you are a human.


Web design by yours truely - me, myself, and I   |   |