mysql5.7 mysql库下面的user表没有password字段无法修改密码
如题所述,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字段无法修改密码的更多相关文章
- mysql下批量清空某个库下的所有表(库不要删除,保留空库)
总所周知,mysql下要想删除某个库下的某张表,只需要切换到该库下,执行语句"drop table tablename"即可删除!但若是该库下有成百上千张表,要是再这样一次次执行d ...
- MySQL数据库实验:任务二 表数据的插入、修改及删除
目录 任务二 表数据的插入.修改及删除 一.利用界面工具插入数据 二.数据更新 (一)利用MySQL命令行窗口更新数据 (二)利用Navicat for MySQL客户端工具更新数据 三.数据库的备份 ...
- MySQL5.7绿色版(免装版)的初始化和修改密码
1.下载MySQL5.7.18绿色版 1.1下载链接 以下是MySQL5.7.18绿色版的链接(来源oracle官网),打开链接直接下载 https://dev.mysql.com/gt/Downlo ...
- python测试开发django-27.表单提交之post修改密码
前言 跟账号相关的功能一般是注册,登录,修改密码,密码找回功能,前面实现了登录和注册功能,本篇讲下修改密码功能实现 修改密码html <!DOCTYPE html> <html la ...
- Oracle创建表、删除表、修改表(添加字段、修改字段、删除字段)语句总结
创建表: create table 表名 ( 字段名1 字段类型 默认值 是否为空 , 字段名2 字段类型 默认值 是否为空, 字段名3 字段类型 默认值 是否为空, ...... ); 创建一个us ...
- innobackupex对MySQL做热备份,报错mysql库下数据字典表损坏
[root@node1 op]#mysql -Vmysql Ver 14.14 Distrib 5.6.29innobackupex热备份MySQL报错,报错信息:[root@node1 op]#in ...
- 通过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 ...
- MYSQL 下一些常用操作命令:新建用户、修改密码、修改登录host等
1.登录服务器 mysql -u <用户名> -p 2.增加用户,并同时授权操作权限 grant select,insert,update,delete on <数据库>.* ...
- MySql 建表、添加字段、修改字段、添加索引SQL语句写法及SQL索引
---------添加索引方法--------- .添加PRIMARY KEY(主键索引) mysql>ALTER TABLE `table_name` ADD PRIMARY KEY ( `c ...
随机推荐
- kafka及扩展的安装笔记
参考文件 https://blog.csdn.net/weiwenjuan0923/article/details/76152744 一.首先确认下jdk有没有安装 安装参照这个连接 https:// ...
- linux下安装VMware出错:Gtk-Message: Failed to load module "canberra-gtk-module"解决方法
最近又有兴趣在linux下搭建个虚拟机,于是去找了个VMWorkstation,安装的过程中报了两个错误 Gtk-Message: Failed to load module "pk-gtk ...
- Why I get “No connection associated with this command”?
- LED室内定位算法:RSS,TOA,AOA,TDOA(转载)
转载自:https://blog.csdn.net/baidu_38197452/article/details/77115935 基于LED的室内定位算法大致可以分为四类: 1. 几何测量法 这种方 ...
- poj2631 Roads in the North(求树的直径)
Roads in the North Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 2941 Accepted: 144 ...
- 【ELK】ELK安装与配置
一.ELK体系结构 二.系统环境变量 [主机信息] IP 主机名 操作系统版本 10.10.10.102 console CentOS7.5 10.10.10.103 log1 CentOS7.510 ...
- lambda表达式与函数接口的关系以及使用案例
lambda表达式与函数式接口是结合使用的. 函数式接口:接口中只有一个抽象方法的接口,其中可以包括default修饰,static 修饰的实例方法.函数式接口可以在接口上添加@FuncationIn ...
- CSS视觉格式化模型
CSS视觉格式化模型(visual formatting model)是用来处理文档并将它显示在视觉媒体上的机制.这是CSS 2.1的一个基础概念.视觉格式化模型根据CSS盒模型为文档的每个元素生成0 ...
- EXCEL合并单元格快捷键暨WORD+EXCEL自定义快捷键
最近在写测试用例时,用到合并单元格,只能点,没有快捷键,觉得很蛋疼,上网找了一下,没有直接设置其对应快捷键的方法,但有种曲线救国的方法: 一.右击功能区,选择‘自定义快速访问工具栏’ 二.可以在这 ...
- jmeter连接数据库之增删改查
配置jdbc: 查询sql配置: 插入sql配置: 修改sql配置: 删除sql配置: