I am using the mysql command line client and I do not want to need to provide the password every time I start the client. What are my options?
MySQL Client Password – How to Store or Setup Passwordless Authentication
MySQL
Related Topic
- Mysql – Creating new MySQL user… password and privileges not sticking
- Mysql – What’s a secure alternative to using a MySQL password on the command line
- MySQL rejects login attempts when password is stored in options file
- Linux – How is using a MySQL password from the command line insecure
- MySQL – Fix mysqldump Unknown Table ‘COLUMN_STATISTICS’ Error
Best Answer
Create a file named
.my.cnf
in your home directory that looks like this. Make sure the filesystem permissions are set such that only the owning user can read it (0600).Since you also tagged your question mysqldump you should look at this question.
Using mysqldump in cron job without root password
Update (2016-06-29) If you are running mysql 5.6.6 or greater, you should look at the mysql_config_editor tool that allows you to store credentials in an encrypted file. Thanks to Giovanni for mentioning this to me.