答案1
我已经想通了。
解决方案1 技巧是:设置“SET PASSWORD FOR root@localhost=PASSWORD('')”显然 dbconfig-common 仅在密码为空时才起作用。
这与“/etc/mysql/debian.cnf”文件的内容有关,在我的例子中,该文件设置了空密码:
[client]
host = localhost
user = root
password =
socket = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host = localhost
user = root
password =
socket = /var/run/mysqld/mysqld.sock
basedir = /usr
解决方案2
将root用户的密码放入/etc/mysql/debian.cnf
[client]
host = localhost
user = root
password = **** password here *****
socket = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host = localhost
user = root
password = **** password here *****
socket = /var/run/mysqld/mysqld.sock
basedir = /usr