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

Updated:   |  mySQL / MariaDB articles

In this example, passwordless authentication will be configured for root. If you want to reset root password, issue the following command.

mysqladmin -u root --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.

[client]
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;"

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


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