新版MySQL修改密码问题

来源:互联网 发布:杭州erp软件开发 编辑:程序博客网 时间:2024/05/17 08:48

转http://blog.csdn.net/u013066244/article/details/53008869

修改密码

登录成功后,我想修改密码,使用命令:

update user set password=password('root') where user='root'; 
  • 1

结果总是提示Unknown column 'password' in 'field list'

原来新版本没有password这个字段了,改成authentication_string

把命令改成

update user set authentication_string=password('root') where user='root'; 
  • 1

就可以啦

再一次重启后出现如下问题

Your password has expired. To log in you must change it using a client that supports expired passwords

解决办法:
进行MySQL的bin打开cmd

mysqladmin -uroot -p password

在Enter password:root,这里root是我的密码,也就是通过上面update更新密码。
New password:输入新密码
confirm password:输入确认密码。

这里讲个小知识:在my.ini配置文件中最后加上skip-grant-tables,可以是登录MySQL时,不进行权限认证。(要是没有my.ini,请拷贝my-default.ini,并改名字为my.ini).
my.ini的配置信息:

[mysqld]# Remove leading # and set to the amount of RAM for the most important data# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.# innodb_buffer_pool_size = 128M# Remove leading # to turn on a very important data integrity option: logging# changes to the binary log between backups.# log_bin# These are commonly set, remove the # and set as required. basedir = D:\Program Files\mysql-5.7.16-winx64 datadir = D:\Program Files\mysql-5.7.16-winx64\data port = 3306 max_connections=200 bind-address = 0.0.0.0# server_id = .....# Remove leading # to set options mainly useful for reporting servers.# The server defaults are faster for transactions and fast SELECTs.# Adjust sizes as needed, experiment to find the optimal values.# join_buffer_size = 128M# sort_buffer_size = 2M# read_rnd_buffer_size = 2M sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES #skip-grant-tables
  • 1

这篇讲解了MySQL ERROR 1045 (28000): Access denied for user ‘root’@’localhost’
(using password: NO)的真正原因。不过是在Linux环境中。

http://www.cnblogs.com/kerrycode/p/4368312.html

原创粉丝点击