0

If I could set the password for debian-sys-maint, then I could install the phpmyadmin package, and that would be great! But with mySQL 5.7 and some random local configuration, it is somehow Not So Easy to set passwords, because it's not obvious which authentication module I should talk to. I've tried:

 mysql> alter user 'debian-sys-maint'@'localhost' identified with mysql_native_password as 'MyNewPass';
 ERROR 1396 (HY000): Operation ALTER USER failed for 'debian-sys-maint'@'localhost'
 mysql> alter user 'debian-sys-maint'@'localhost' identified with mysql_native_password as 'MyNewPass';
 ERROR 1396 (HY000): Operation ALTER USER failed for 'debian-sys-maint'@'localhost'
 mysql> flush privileges;
 Query OK, 0 rows affected (0.01 sec)



 mysql> show plugins
     -> ;
 +----------------------------+----------+--------------------+---------+---------+
 | Name                       | Status   | Type               | Library | License |
 +----------------------------+----------+--------------------+---------+---------+
 | binlog                     | ACTIVE   | STORAGE ENGINE     | NULL    | GPL     |
 | mysql_native_password      | ACTIVE   | AUTHENTICATION     | NULL    | GPL     |
 | sha256_password            | ACTIVE   | AUTHENTICATION     | NULL    | GPL     |
   ...
 | MEMORY                     | ACTIVE   | STORAGE ENGINE     | NULL    | GPL     |
 | InnoDB                     | ACTIVE   | STORAGE ENGINE     | NULL    | GPL     |
 +----------------------------+----------+--------------------+---------+---------+
 44 rows in set (0.00 sec)


 $ apt-show-versions | grep -i mysql
 dbconfig-mysql:all/xenial 2.0.4ubuntu1 uptodate
 libmysqlclient-dev:amd64/xenial-security 5.7.17-0ubuntu0.16.04.1 upgradeable to 5.7.18-0ubuntu0.16.04.1
 libmysqlclient-dev:i386 not installed
 libmysqlclient20:amd64/xenial-security 5.7.17-0ubuntu0.16.04.1 upgradeable to 5.7.18-0ubuntu0.16.04.1
 libmysqlclient20:i386 not installed
 mysql-client:all/xenial-security 5.7.17-0ubuntu0.16.04.1 upgradeable to 5.7.18-0ubuntu0.16.04.1
 mysql-client-5.7:amd64/xenial-security 5.7.18-0ubuntu0.16.04.1 uptodate
 mysql-client-5.7:i386 not installed
 mysql-client-core-5.7:amd64/xenial-security 5.7.18-0ubuntu0.16.04.1 uptodate
 mysql-client-core-5.7:i386 not installed
 mysql-common:all/xenial-security 5.7.18-0ubuntu0.16.04.1 uptodate
 mysql-server:all/xenial-security 5.7.18-0ubuntu0.16.04.1 uptodate
 mysql-server-5.7:amd64/xenial-security 5.7.18-0ubuntu0.16.04.1 uptodate
 mysql-server-5.7:i386 not installed
 mysql-server-core-5.7:amd64/xenial-security 5.7.18-0ubuntu0.16.04.1 uptodate
 mysql-server-core-5.7:i386 not installed
 php-mysql:all/xenial 1:7.0+35ubuntu6 uptodate
 php7.0-mysql:amd64/xenial-security 7.0.15-0ubuntu0.16.04.4 uptodate
 php7.0-mysql:i386 not installed

How can I set the password?

  • 1
    Please check sudo cat /etc/mysql/debian.cnf to see if You have password there. Idk if that will be a debian.cnf in ubuntu, check for the cnf file. – Eska May 2 '17 at 21:25
  • I manually edited it to include MyNewPass, but that doesn't affect mysql. – Dave Morse May 2 '17 at 21:29
  • 1
    Did You restarted the mysql after? – Eska May 2 '17 at 21:29
  • 1
    To update password, use SET PASSWORD FOR 'debian-sys-maint'@'localhost' = PASSWORD('Your PWD here'); after logging in to mysql as root. Set password in the file, then set it thru mysql statement. – Eska May 2 '17 at 21:35
  • mysql> SET PASSWORD FOR 'debian-sys-maint'@'localhost' = PASSWORD('MyNewPass'); ERROR 1133 (42000): Can't find any matching row in the user table – Dave Morse May 2 '17 at 21:43
0

This seems to have worked:

UPDATE mysql.user SET authentication_string=PASSWORD('MyNewPass') WHERE  User='debian-sys-maint' AND Host='localhost';
flush privileges;

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.