# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host = localhost
user = debian-sys-maint
password = bFPCQUvTEzk9reOp
socket = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host = localhost
user = debian-sys-maint
password = bFPCQUvTEzk9reOp
socket = /var/run/mysqld/mysqld.sock
解决方法:
1.打开/etc/mysql/debian.cnf文件,里面存储了相关的密码,我的文件信息如下
sudovi /etc/mysql/debian.cnf# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host = localhost
user = debian-sys-maint
password = 6x1XG2B5p75WtFV2
socket = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host = localhost
user = debian-sys-maint
password = 6x1XG2B5p75WtFV2
socket = /var/run/mysqld/mysqld.sock
basedir = /usr
在[client]段有user=以及password=这两行,这就是通过apt-get安装mysql,系统给我们设置的mysql登录名和密码
2. 输入命令:
mysql -udebian-sys-maint -pdebian-sys- maint即debian.cnf中user=后面的内容.回车后会提示输入密码,此时把password=后面的内容复制粘贴后回车即可进行mysql 控制台
3.进入控制台后.按以下步骤进行:
use mysql;update user set password=PASSWORD('新密码') where user='root';FLUSH PRIVILEGES;此时可以输入quit;退出后用root帐号登录,也可以继续其他操作.
MySQL5.7更改密码时出现ERROR 1054 (42S22): Unknown column 'password' in 'fie
[摘要:新装置的MySQL5.7,登录时提醒暗码毛病,装置的时间并出有变动暗码,厥后经过免暗码登录的体式格局变动暗码,输进update mysql.user set password=password('root') where user]
新安装的MySQL5.7,登录时提示密码错误,安装的时候并没有更改密码,后来通过免密码登录的方式更改密码,输入update mysql.user set password=password('root') where user='root'时提示ERROR 1054 (42S22): Unknown column 'password' in 'field list',原来是mysql数据库下已经没有password这个字段了,password字段改成了
authentication_string
所以更改语句替换为update mysql.user set authentication_string=password('root') where user='root' ;即可
我的系统版本如下:
\
完整的更改MySQL密码的方式如下:
1、vim /etc/my.cnf 加入skip-grant-tables
\
2、重启MySQL, /etc/init.d/mysqld restart
\
3、终端输入 mysql 直接登录MySQL数据库,然后use mysql
\
4、update mysql.user set authentication_string=password('root') where user='root' ;
\
5、编辑my.cnf文件删掉skip-grant-tables 这一行,然后重启MySQL,/etc/init.d/mysqld restart,否则MySQL仍能免密码登录
6、mysql -u root -p
然后输入密码即可登录MySQL数据库