在下载MySQL解压版并安装完成后,出现了一些问题。
安装教程> http://jingyan.baidu.com/article/8cdccae946033f315513cd7a.html?qq-pf-to=pcqq.group
登录命令
第一次登录时,由于是解压版,密码为空。所以在输入密码时,直接回车就可以啦
mysql –uroot -p
修改密码
登录成功后,我想修改密码,使用命令:
update user set password=password('root') where user='root';
结果总是提示Unknown column 'password' in 'field list'
原来新版本没有password这个字段了,改成authentication_string
把命令改成
update user set authentication_string=password('root') where user='root';
就可以啦
再一次重启后出现如下问题
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
这篇讲解了MySQL ERROR 1045 (28000): Access denied for user ‘root’@’localhost’
(using password: NO)的真正原因。不过是在Linux环境中。