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... mysql --login-path=localERROR 1045 (28000): Access denied for userSet this with expect You would execute this via your bash script. expect
MySQL mysql_config_editor & expect appeared first on MariaDB.org
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...
mysql --login-path=local
ERROR 1045 (28000): Access denied for user
Set this with expect
You would execute this via your bash script.
expect <<EOD
spawn mysql_config_editor set --login-path=local --host=localhost --user=root --password
expect "password"
send -- "<PASSWORD>\r"
interact
EOD
Now it works...
mysql --login-path=local
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1002
| # | Наименование новости | Тональность | Информативность | Дата публикации |
|---|---|---|---|---|
| 1 | Lessons From 20 Years Hacking MySQL (Part 1) | 0 | 13.63 | 20-06-2024 |
| 2 | Access Patterns for MySQL | 0 | 5.66 | 17-04-2022 |
| 3 | MariaDB Honeypot | 0 | 9.31 | 06-03-2025 |
| 4 | MySQL Password Rotation with AWS Secrets Manager and Lambda | 0 | 4.63 | 28-12-2020 |
| 5 | Selecting a character set for MySQL and MariaDB clients | 0 | 7.47 | 29-03-2026 |
| 6 | MariaDB Encryption ( data at rest ) | 0 | 5.71 | 25-02-2024 |
| 7 | Grokking the MariaDB test runner (MTR) | 0 | 6.77 | 19-02-2023 |
| 8 | Building MariaDB Server from the sources | 0 | 5.29 | 05-04-2024 |
| 9 | MariaDB/MySQL Environment MyEnv 2.1.0 has been released | 0 | 7.02 | 28-02-2024 |