Can I enter password once for multiple mysql command line invocations, where the queries are not known upfront? -
you can avoid re-entering mysql command line password putting queries file.
in case, later queries not determined until after first queries have finished.
this happens in non-interactive script running mysql console not option.
is there notion of session mysql command line interactions? or can set listen commands on local unix socket (the output required returned)? or that?
user @smcjones mentions using .my.cnf file or mysql_config_editor. suggestions, give +1 vote him.
another solution put credentials in file of choosing , specify file when invoke mysql tools:
mysql --defaults-extra-file=my_special.cnf ...other arguments...
and finally, completeness, can use environment variables options, host , password. strangely, not user. see http://dev.mysql.com/doc/refman/5.7/en/environment-variables.html
export mysql_host="mydbserver" export mysql_pwd="xyzzy" mysql ...other arguments...
i don't recommend using environment variable password, since can run ps
on client host can see environment variables mysql client process.
Comments
Post a Comment