2

My system monitoring program isn't working anymore since upgrading from Ubuntu Server 14.04 to 16.04 with MySQL 5.6 to 5.7. It performs the following command:

mysqladmin -u statuser extended-status

It also sets the MYSQL_PWD environment variable for that process to the required password. The error message however is:

mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'statuser'@'localhost' (using password: YES)'

When I try it interactively, it works fine:

mysqladmin -u statuser -p extended-status
(type in the password)

When I try to reproduce the tool's behaviour like this, it also fails:

MYSQL_PWD='********' mysqladmin -u statuser extended-status

So isn't MYSQL_PWD supported anymore? But it says "using password: YES" so it must have noticed my environment variable. It just doesn't seem to read it right.

5
  • What happens if you try to use MYSQL_PWD='xxx' mysql -u statuser -p Nov 27, 2016 at 13:59
  • Maybe the easiest solution would be to store the password in some other way. The MySQL docs describe multiple ways, and expressively say that using the MYSQL_PWD env variable is discouraged. Nov 27, 2016 at 13:59
  • If I set the variable and the -p parameter, I need to type in the password. If I just press Enter then, it says "access denided, using password: NO"
    – ygoe
    Nov 27, 2016 at 14:00
  • Thanks I was trying to see if the MYSQL_PWD works for regular mysql client, which it doesn't appear to be working. Can you try making a new user with a very simple password no spaces and try setting that like MYSQL_PWD=abc123 mysql -u newuser I'm thinking some kind of quote trimming has changed Nov 27, 2016 at 14:03
  • That is already a separate user for this statistics purpose. The password does not contain spaces. I've now changed it to pass the password as command line argument, for the "insecure" but not "extremely insecure" option. It prints a warning into my terminal from the background, but that won't bother me once I get that tool running as a service again. (Stupid upstart has been replaced by systemd, too... As if Ubuntu knew their special solution wouldn't last long.)
    – ygoe
    Nov 27, 2016 at 14:13

1 Answer 1

0

Hey buddies I used these commands and it solved my issue:

mysql -uroot -p -hlocalhost
sudo service mysql restart
mysql -u root -p

Hope it should relieve you the agony

1
  • 2
    Can't downvote. What does this answer have to do with my question?
    – ygoe
    Nov 29, 2016 at 21:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.