This is just a note to help out anyone that might want to use the mysql_config_editor command in their automation tools.
the mysql_config_editor does not take a password argument so automation tools that might have before set your password in the .my.cnf file trying to use mysql_config_editor fails.
It is possible and quite simple though with the expect tool.
yum -y install expect
it works for apt-get also.
So in this example, I will show a simple bash script version.
1st.. my login path does not work...
ERROR 1045 (28000): Access denied for user
Set this with expect
You would execute this via your bash script.
spawn mysql_config_editor set --login-path=local --host=localhost --user=root --password
send -- "<PASSWORD>\r"
Now it works...
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1002
Post a Comment