Advertisements
Set the credentials using the following command:
mysql_config_editor set --login-path=local --host=localhost --user=username --password
Now you can run the command as:
mysql --login-path=local -e "statement"
Instead of:
mysql -u username -p pass -e "statement"
An alternate way for the older version is to use --defaults-extra-file option.
Create a credentials file my.cnf
cat my.cnf
[mysql]
host = hostname
user = username
password = password
Then when you execute the mysql command specify the path to my.cnf command as
mysql --defaults-extra-file=/path_to/my.cnf
No comments:
Post a Comment
Be nice. That's all.