如题所述,mysql5.7  mysql库下面的user表没有password字段无法修改密码,

5.7版本已经不再使用password来作为密码的字段了  而改成了authentication_string

登陆密码记不起:

[root@master1 ~]# mysql -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

更改配置

vi /etc/my.cnf
#在mysqld模块下添加
skip-grant-tables

重启服务

systemctl restart mysqld

按照传统改密码方式发现没有 password这个字段。

mysql> update user set password=password('123') where user='root';
ERROR 1054 (42S22): Unknown column 'password' in 'field list'

查询user表结构

mysql> desc user;
+------------------------+-----------------------------------+------+-----+-----------------------+-------+
| Field                  | Type                              | Null | Key | Default               | Extra |
+------------------------+-----------------------------------+------+-----+-----------------------+-------+
| Host                   | char(60)                          | NO   | PRI |                       |       |
| User                   | char(32)                          | NO   | PRI |                       |       |
| Select_priv            | enum('N','Y')                     | NO   |     | N                     |       |
| Insert_priv            | enum('N','Y')                     | NO   |     | N                     |       |
| Update_priv            | enum('N','Y')                     | NO   |     | N                     |       |
| Delete_priv            | enum('N','Y')                     | NO   |     | N                     |       |
| Create_priv            | enum('N','Y')                     | NO   |     | N                     |       |
| Drop_priv              | enum('N','Y')                     | NO   |     | N                     |       |
| Reload_priv            | enum('N','Y')                     | NO   |     | N                     |       |
| Shutdown_priv          | enum('N','Y')                     | NO   |     | N                     |       |
| Process_priv           | enum('N','Y')                     | NO   |     | N                     |       |
| File_priv              | enum('N','Y')                     | NO   |     | N                     |       |
| Grant_priv             | enum('N','Y')                     | NO   |     | N                     |       |
| References_priv        | enum('N','Y')                     | NO   |     | N                     |       |
| Index_priv             | enum('N','Y')                     | NO   |     | N                     |       |
| Alter_priv             | enum('N','Y')                     | NO   |     | N                     |       |
| Show_db_priv           | enum('N','Y')                     | NO   |     | N                     |       |
| Super_priv             | enum('N','Y')                     | NO   |     | N                     |       |
| Create_tmp_table_priv  | enum('N','Y')                     | NO   |     | N                     |       |
| Lock_tables_priv       | enum('N','Y')                     | NO   |     | N                     |       |
| Execute_priv           | enum('N','Y')                     | NO   |     | N                     |       |
| Repl_slave_priv        | enum('N','Y')                     | NO   |     | N                     |       |
| Repl_client_priv       | enum('N','Y')                     | NO   |     | N                     |       |
| Create_view_priv       | enum('N','Y')                     | NO   |     | N                     |       |
| Show_view_priv         | enum('N','Y')                     | NO   |     | N                     |       |
| Create_routine_priv    | enum('N','Y')                     | NO   |     | N                     |       |
| Alter_routine_priv     | enum('N','Y')                     | NO   |     | N                     |       |
| Create_user_priv       | enum('N','Y')                     | NO   |     | N                     |       |
| Event_priv             | enum('N','Y')                     | NO   |     | N                     |       |
| Trigger_priv           | enum('N','Y')                     | NO   |     | N                     |       |
| Create_tablespace_priv | enum('N','Y')                     | NO   |     | N                     |       |
| ssl_type               | enum('','ANY','X509','SPECIFIED') | NO   |     |                       |       |
| ssl_cipher             | blob                              | NO   |     | NULL                  |       |
| x509_issuer            | blob                              | NO   |     | NULL                  |       |
| x509_subject           | blob                              | NO   |     | NULL                  |       |
| max_questions          | int(11) unsigned                  | NO   |     | 0                     |       |
| max_updates            | int(11) unsigned                  | NO   |     | 0                     |       |
| max_connections        | int(11) unsigned                  | NO   |     | 0                     |       |
| max_user_connections   | int(11) unsigned                  | NO   |     | 0                     |       |
| plugin                 | char(64)                          | NO   |     | mysql_native_password |       |
| authentication_string  | text                              | YES  |     | NULL                  |       |
| password_expired       | enum('N','Y')                     | NO   |     | N                     |       |
| password_last_changed  | timestamp                         | YES  |     | NULL                  |       |
| password_lifetime      | smallint(5) unsigned              | YES  |     | NULL                  |       |
| account_locked         | enum('N','Y')                     | NO   |     | N                     |       |
+------------------------+-----------------------------------+------+-----+-----------------------+-------+

网上查了一下据说5.7 版本password 字段改成authentication_string  password函数还是原来的password函数

mysql> update user set authentication_string=password('123') where user='root';
Query OK, 1 row affected, 1 warning (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 1

#更改配置重启mysql  成功登陆

[root@master1 ~]# vi /etc/my.cnf注释 # skip-grant-tables
[root@master1 ~]# systemctl restart mysqld
[root@master1 ~]# mysql -uroot -p123
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.21-logCopyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> 

转载于:https://www.cnblogs.com/benjamin77/p/8681763.html

mysql5.7 mysql库下面的user表没有password字段无法修改密码相关推荐

  1. mysql user表没有password字段,远程连接密码为空

    mysql user表没有password字段,Navicat远程连接密码为空 在控制台登录mysql时,输入密码123456成功登录,没什么问题 mysql -u root -p 打开Navicat ...

  2. mysql root 没有库_mysql root用户看不到mysql库下的所有表

    1.首先停止mysql服务:service mysqld stop 2.加参数启动mysql:/usr/bin/mysqld_safe --skip-grant-tables & 然后就可以无 ...

  3. mysql 获取一个库下的所有表名

    http://dev.mysql.com/doc/refman/5.1/zh/information-schema.html 官网上的第一个例子: mysql> SELECT table_nam ...

  4. mysql表索引类型修改_MySQL常用的建表、添加字段、修改字段、添加索引SQL语句写法总结...

    本文实例讲述了MySQL常用的建表.添加字段.修改字段.添加索引SQL语句写法.分享给大家供大家参考,具体如下: 建表: DROP TABLE IF EXISTS bulletin; CREATE T ...

  5. centos的mysql怎么删用户_linux/centos给Mysql创建用户、授权、查看、删除、修改密码、撤...

    linux/centos给Mysql创建用户.授权.查看.删除.修改密码.撤 linux/centos给Mysql创建用户.授权.查看.删除.修改密码.撤销权限 linux/centos给Mysql创 ...

  6. MySql中添加用户,新建数据库,用户授权,删除用户,修改密码

    MySql中添加用户,新建数据库,用户授权,删除用户,修改密码(注意每行后边都跟个;表示一个命令语句结束): 1.新建用户 登录MYSQL: @>mysql -u root -p @>密码 ...

  7. Oracle删除表、修改表(添加字段、修改字段、删除字段)语句总结

    Oracle删除表.修改表(添加字段.修改字段.删除字段)语句总结 1.删除表: delete from 表名; delete删除数据是一条一条的删除数据,后面可以添加where条件,不删除表结构.注 ...

  8. mysql修改索引的sql_mysql-建表、添加字段、修改字段、添加索引SQL语句写法

    表的操作 1.建表 --如果USERS表存在则删除 DROP TABLE IF EXISTS USERS; CREATE TABLE USERS( id INT UNSIGNED NOT NULL A ...

  9. mysql表添加字段语句_mysql-建表、添加字段、修改字段、添加索引SQL语句写法

    表的操作 1.建表 1.建表 --如果USERS表存在则删除 DROP TABLE IF EXISTS USERS; CREATE TABLE USERS( id INT UNSIGNED NOT N ...

最新文章

  1. GCC编译选项--创建与使用库
  2. 语义分割--Global Deconvolutional Networks for Semantic Segmentation
  3. Ruby_day[1]控制流2
  4. matlab等距线扫描多边形程序实现_常用的3D扫描仪都有哪些类型?
  5. native固定吸顶 react_React Native固定底部TextInput,解决键盘遮挡、列表滚动问题
  6. Web前端开发笔记——第四章 JavaScript程序设计 第二节 变量
  7. 使用SecureCRT时屏幕僵死的处理方法——Linux终端设置技巧
  8. 我的第一个wp8小程序
  9. ubuntu server 16.04 开启root密码登录
  10. 5G应用前景广泛 不止是下电影更快,还能做这些事……
  11. Qt QMake详解
  12. 手机语音混响软件_Tone2 UltraSpace(音频混响软件)
  13. 通通WPF随笔 3 艺术二维码素材生成器
  14. 【Flask】学习笔记 #12 —— JinJa2模板继承与引入
  15. ReactOS 代码更新后的编译安装
  16. 华三模拟器:路由备份路由聚合
  17. Android开发技巧——Camera拍照功能
  18. 就在这一天,我结束了北漂的生活
  19. 用 CaptureScreenshot捕捉游戏画面(截图,截屏)
  20. day75,爬虫02,webmagic入门程序,组件介绍:Downloader,PageProcess,pipeline,Scheduler,51jop招聘网站综合案例

热门文章

  1. 程序员怒斥:虎牙HR真奇葩,通知我面试,又何必当面羞辱我一番?
  2. PS制作棱镜化多边形照片效果
  3. web前端开发规范总结
  4. 女孩子适合学习前端开发吗?
  5. 高级灰rgb数值_插画的高级感,从何而来?
  6. 台式机鼠标失灵打开计算机,台式电脑鼠标不动了怎么办
  7. python怎么重复程序_利用Python程序完成ABAQUS中的一些重复性操作
  8. 【博客大赛】100行js代码实现网站在线用户数量统计 nodejs + socket.io方案
  9. mysql设置最大查询时间_mysql如何限制sql查询时间
  10. cad2010多个文件并排显示_飞利浦显示器推荐,提升你的工作效率与水平