Whenever you enter a password using a command-line client, you might have noticed the following warning:
shell> mysql -u dbadmin -p'$troNgP@$$w0rd'
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1345
Server version: 8.0.3-rc-log MySQL Community Server (GPL)
~
mysql>
If you do not pass the password in the command line and enter when it prompts, you won't get that warning:
shell> mysql -u dbadmin -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1334 Server version: 8.0.3-rc-log MySQL Community Server (GPL) ~ mysql>
However, when you are developing some scripts over the client utilities, it is difficult to use with password prompt. One way to avoid this is by storing the password in the .my.cnf
file in the home
directory. The mysql
command-line utility, by...