The MySQL client program /usr/bin/mysql does not accept passwords passed using the MYSQL_PWD environment variable

Newly built Virtualmin servers always give the following notice on attempt to save the database root password:

The MySQL client program /usr/bin/mysql does not accept passwords passed using the MYSQL_PWD environment variable. To ensure that Webmin is able to fully communicate with MySQL, this option should be turned off on the module configuration page.

and it is so inconvenient to change that setting manually every single time. Unfortunately, this setting is not stored together with Virtualmin configuration backup (webmin/virtual-server/config), because it resides in different file /etc/webmin/mysql/config. So to save it once and then just restore Virtualmin's settings on a new server won't work. So you have to probably backup the database settings through Webmin.

However, it would be much nicer if Virtualmin did configure necessary setting during its setup, so users don't have to meddle with backing up and restoring.

Status: 
Closed (fixed)

Comments

It's odd that this is required though, as the mysql command should accept passwords via MYSQL_PWD.

Which mysql version are you running there?

It is mysql Ver 15.1 Distrib 5.5.56-MariaDB, for Linux (x86_64) using readline 5.1. Please test it with CentOS 7.x and it will always output that error.

Check that the /root/.my.cnf file doesn't contain a password line - because this overrides the MYSQL_PWD environment variable, it isn't compatible with Webmin.

Hm, that's the culprit then, because that file does have password set. But then either this should be documented and probably reflected in the error message not to confuse users or, ideally, addressed so it becomes compatible.

I'll update the error message to make the cause of this clearer.

Status: Fixed ยป Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.