array(2) { ["docs"]=> array(0) { } ["count"]=> int(0) } 111string(0) "" int(1) int(10) int(70) int(8640000) string(13) "likecs_art_db" array(1) { ["query"]=> array(1) { ["match_all"]=> object(stdClass)#28 (0) { } } } array(1) { ["createtime.keyword"]=> array(1) { ["order"]=> string(4) "desc" } } int(10) int(0) int(8640000) array(2) { ["docs"]=> array(0) { } ["count"]=> int(0) } mysql 5.7密码修改 - 爱码网

官网下载安装包:https://dev.mysql.com/downloads/mysql/

一、停止mysqld服务

二、编辑配置文件

有的Linux版本是/etc/my.cnf
有的Linux版本是/etc/mysql/mysql.conf.d/mysqld.cnf
windows配置文件名字为my.INI

# 在配置文件中添加配置项 [mysqld] skip-grant-tables

三、重新启动mysqld服务并登陆

systemctl restart mysqld

mysql -u root -p 

四、修改root密码

# 注意,user表没有“password”字段了,取代的是“authentication_string”。

update mysql.user set authentication_string=password('123456') where User='root' and Host='localhost';

#上面密码是不可取的!会在后续操作中遇到如下提示:

ERROR 1819 (HY000) at line 1: Your password does not satisfy the current policy requirements

请设置一个稍微复杂的密码吧!例如【大写字母+小写字母+特殊字符+数字】。

五、刷新配置

flush privileges;

# 去掉skip-grant-tables配置项

因为这一配置项的意思是“跳过权限表的限制,不用密码验证,直接登录”,在生产环境中是绝对不行的。

再次执行mysql命令需要密码了。

转自:https://www.cnblogs.com/yoyotl/p/6387207.html

相关文章: