如题所述,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('') where user='root';
ERROR (42S22): Unknown column 'password' in 'field list'

查询user表结构

mysql> desc user;
+------------------------+-----------------------------------+------+-----+-----------------------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------------------+-----------------------------------+------+-----+-----------------------+-------+
| Host | char() | NO | PRI | | |
| User | char() | 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() unsigned | NO | | | |
| max_updates | int() unsigned | NO | | | |
| max_connections | int() unsigned | NO | | | |
| max_user_connections | int() unsigned | NO | | | |
| plugin | char() | 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() unsigned | YES | | NULL | |
| account_locked | enum('N','Y') | NO | | N | |
+------------------------+-----------------------------------+------+-----+-----------------------+-------+

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

mysql> update user set authentication_string=password('') where user='root';
Query OK, row affected, warning (0.00 sec)
Rows matched: Changed: 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
Server version: 5.7.-log Copyright (c) , , 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>

mysql5.7 mysql库下面的user表没有password字段无法修改密码的更多相关文章

  1. mysql下批量清空某个库下的所有表(库不要删除,保留空库)

    总所周知,mysql下要想删除某个库下的某张表,只需要切换到该库下,执行语句"drop table tablename"即可删除!但若是该库下有成百上千张表,要是再这样一次次执行d ...

  2. MySQL数据库实验:任务二 表数据的插入、修改及删除

    目录 任务二 表数据的插入.修改及删除 一.利用界面工具插入数据 二.数据更新 (一)利用MySQL命令行窗口更新数据 (二)利用Navicat for MySQL客户端工具更新数据 三.数据库的备份 ...

  3. MySQL5.7绿色版(免装版)的初始化和修改密码

    1.下载MySQL5.7.18绿色版 1.1下载链接 以下是MySQL5.7.18绿色版的链接(来源oracle官网),打开链接直接下载 https://dev.mysql.com/gt/Downlo ...

  4. python测试开发django-27.表单提交之post修改密码

    前言 跟账号相关的功能一般是注册,登录,修改密码,密码找回功能,前面实现了登录和注册功能,本篇讲下修改密码功能实现 修改密码html <!DOCTYPE html> <html la ...

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

    创建表: create table 表名 ( 字段名1 字段类型 默认值 是否为空 , 字段名2 字段类型 默认值 是否为空, 字段名3 字段类型 默认值 是否为空, ...... ); 创建一个us ...

  6. innobackupex对MySQL做热备份,报错mysql库下数据字典表损坏

    [root@node1 op]#mysql -Vmysql Ver 14.14 Distrib 5.6.29innobackupex热备份MySQL报错,报错信息:[root@node1 op]#in ...

  7. 通过java api统计hive库下的所有表的文件个数、文件大小

    更新hadoop fs 命令实现: [ss@db csv]$ hadoop fs -count /my_rc/my_hive_db/* 18/01/14 15:40:19 INFO hdfs.Peer ...

  8. MYSQL 下一些常用操作命令:新建用户、修改密码、修改登录host等

    1.登录服务器 mysql -u <用户名> -p 2.增加用户,并同时授权操作权限 grant select,insert,update,delete on <数据库>.* ...

  9. MySql 建表、添加字段、修改字段、添加索引SQL语句写法及SQL索引

    ---------添加索引方法--------- .添加PRIMARY KEY(主键索引) mysql>ALTER TABLE `table_name` ADD PRIMARY KEY ( `c ...

随机推荐

  1. DOS中断及程序调用

    http://www.cnblogs.com/ynwlgh/archive/2011/12/12/2285017.html

  2. (转) Redis哨兵的详解

    1 哨兵的作用 哨兵是redis集群架构中非常重要的一个组件,主要功能如下: 1. 集群监控:负责监控redis master和slave进程是否正常工作 2. 消息通知:如果某个redis实例有故障 ...

  3. JVM垃圾回收原理

    原文地址:http://chenchendefeng.iteye.com/blog/455883 一.相关概念 基本回收算法 1. 引用计数(Reference Counting) 比较古老的回收算法 ...

  4. JAVA后端常用框架SSM,redis,dubbo等

    JAVA后端常用框架SSM,redis,dubbo等   一.SpringMVC http://blog.csdn.net/evankaka/article/details/45501811 spri ...

  5. xcode6没有prefix.pch预编译文件解决办法

    注意到Xcode6创建的工程没有prefix.pch. 于是手动创建. 在other下选择pch文件 接着到工程的build setting下设置开启预编译并配置路径(文件的路径.因为我新建在cofi ...

  6. CentOS 7使用dnf安装Memcached以及启动、停止、开机启动等设置

    1.安装Memcached dnf install memcached 根据提示完成安装 2.启动Memcached 输入以下命令: service memcached start 输出以下内容: R ...

  7. Python-S9-Day101 Vue-cli

    01 昨天内容回顾 02 音乐播放器计算属性方法和组件创建 03 Vue-cli项目生成 04 模板中组件的使用 01 昨天内容回顾 1.1 {{xxx}}模板语法,插值,简单的运算: 1.2 指令系 ...

  8. git和github基础入门

    一.git: 1.安装配置git: 1.1从官网或者该网址处下载:https://pan.baidu.com/s/1kU5OCOB#list/path=%2Fpub%2Fgit 1.2安装,一路nex ...

  9. imx6移植librtmp

    一.openssl交叉编译 1.下载 https://www.openssl.org/source/ 版本不要太高,刚开始版本高了,有些函数取消了,链接不上 使用1.0.1f即可 2.编译成共享库 . ...

  10. [oldboy-django][2深入django]ORM操作

    推荐学习博客:http://www.cnblogs.com/wupeiqi/articles/6216618.html 需求: 汇总django orm操作,代替原生mysql语句来操作数据库:里面内 ...