MySQL5.7更改密码时出现ERROR 1054 (42S22): Unknown column 'password' in 'field list'
2015-12-22 13:16
891 查看
新安装的MySQL5.7,登录时提示密码错误,安装的时候并没有更改密码,后来通过免密码登录的方式更改密码,输入update mysql.user set password=password('root') where user='root'时提示ERROR 1054 (42S22): Unknown column 'password' in 'field list',原来是mysql数据库下已经没有password这个字段了,password字段改成了
所以更改语句替换为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' ;
mysql5.7更改密码应该采用命令
5、编辑my.cnf文件删掉skip-grant-tables 这一行,然后重启MySQL,/etc/init.d/mysqld restart,否则MySQL仍能免密码登录
6、mysql -u root -p
然后输入密码即可登录MySQL数据库
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' ;
mysql5.7更改密码应该采用命令
ALTER USER
'root'
@
'localhost'
IDENTIFIED BY
'********'其中密码的命名规则有所改变,详见
http://blog.csdn.net/u010603691/article/details/50541979
5、编辑my.cnf文件删掉skip-grant-tables 这一行,然后重启MySQL,/etc/init.d/mysqld restart,否则MySQL仍能免密码登录
6、mysql -u root -p
然后输入密码即可登录MySQL数据库
相关文章推荐
- MySQL中的integer 数据类型
- MySQL存储过程
- mysql中int、bigint、smallint 和 tinyint的区别与长度
- mysql load data 导出、导入 csv
- source命令执行SQL脚本文件
- MySQL创建用户及权限控制
- MySQL管理数据表
- linux下mysql添加用户
- mysql procedure
- mysql触发器
- MySQL 备份和恢复策略
- mac下安装mysql(转载)
- mysql 修改编码 Linux/Mac/Unix/通用(杜绝修改后无法启动的情况!)
- MySQL数据的导出、导入(mysql内部命令:mysqldump、mysql)
- mysql数据行转列
- Linux下修改MySQL编码的方法
- MySQL Server 日志
- MySQL 安全事宜
- MySQL 备份与恢复