![mySQL:无法为 debian-sys-maint 设置密码](https://linux22.com/image/999985/mySQL%EF%BC%9A%E6%97%A0%E6%B3%95%E4%B8%BA%20debian-sys-maint%20%E8%AE%BE%E7%BD%AE%E5%AF%86%E7%A0%81.png)
如果我可以设置 debian-sys-maint 的密码,那么我就可以安装 phpmyadmin 包,那就太好了!但是对于 mySQL 5.7 和一些随机的本地配置,设置密码并不那么容易,因为我不清楚应该与哪个身份验证模块通信。我试过:
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
我如何设置密码?
答案1
这似乎有效:
UPDATE mysql.user SET authentication_string=PASSWORD('MyNewPass') WHERE User='debian-sys-maint' AND Host='localhost';
flush privileges;