User Tools

Site Tools


mysql:login_without_a_password

MySQL - Login without a password

If you wish to setup “root” or any user login without having to supply password on command-prompt, you may create a .my.cnf file in your home directory. MySQL reads this file each time it opens the MySQL client. Create the ~/.my.cnf file.

NOTE: ~ represents your HOME directory path in Linux.

.my.cnf
[client]
user=root
password=root-password
host=127.0.0.1
 
[mysql]
database = database-name

Be sure to modify the permission of the file to limit access to yourself, so that other users on the system cannot view this file.

chmod 600 ~/.my.cnf

WARNING: Even with limited file access of the .my.cnf file to yourself, it still posesses security risk as the username and password are stored in clear text form. It is your responsibility to secure your server so that this information is NOT breached.

mysql/login_without_a_password.txt · Last modified: 2020/07/15 10:30 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki