How to Get mysql_config_editor

Viewed 2560

I ran sudo apt-get install mysql-client and it installed correctly. Then I ran mysql_config_editor print and I got

mysql_config_editor: not found

mysql_config_editor does not show up in /usr/bin like I expect it to, and like it does on my other machine.

On the machine where it worked, mysql --version shows

mysql  Ver 8.0.21-0ubuntu0.20.04.3 for Linux on x86_64 ((Ubuntu))

On the machine where it doesn't work, mysql --version shows

mysql  Ver 15.1 Distrib 10.1.45-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

How can I install a version of mysql that comes with mysql_config_editor or install the mysql_config_editor utility itself?

2 Answers

On MariaDB, as we have not a utility like mysql_config_editor to create ~/.login.cnf with obfuscated passwords, neither MariaDB reads it, one could degrade to ~/.my.cnf file with plain text:

[client] 
user=my_username
password=my_password
#port=mysql_port
#socket=my_socket
#database=my_default_dbname

And then change access modes:

chmod 600 ~/.my.conf

Now only you can read this plain text file.

This avoids you to type user and password on command line on debian os in an insecure way, readeable by ps command.

mysql

Ref. https://mariadb.com/kb/en/configuring-mariadb-with-option-files/

Unfortunately MariaDB does not support this feature as explained here : https://mariadb.com/kb/en/mysql_config_editor-compatibility/

MariaDB is a fork of MySQL. So you can use its client to connect to a MySQL DB but it lacks the mysql_config_editor option.

Installing a MySQL client with mysql_config_editor is covered here : https://askubuntu.com/a/708606/943405 But I strongly advice you to uninstall the MariaDB client before and reinstall the full MySQL client to avoid troubles.

If you can't uninstall the MariaDB client then your solution is the best.

Related