---
title: "mysql 5.6 修改默认密码和密码过期"
author: "xxpp688"
date: "2015-04-22T11:11:43Z"
tags: []
categories: ["数据库"]
slug: "mysql-5-6"
draft: false
lastmod: "2015-04-22T11:11:43Z"
id: 2204994
url: "https://xxpp688.iteye.com/blog/2204994"
---

打开my.ini 文件(mysql 安装目录)  
找到 \[mysqld]在下面加上一句话： skip-grant-tables   
重启mysql,现在登陆mysql 已经不需要密码了。  
cmd --&gt; mysql -uroot;   (用root账户登录)  
show databases;  
use mysql;  
update user set password = password('newPwd'),password\_expired='N' where user = 'root';  
(修改密码并取消mysql 5.6的强制密码过期)  
FLUSH PRIVILEGES;  (最后刷新权限)  
再去my.ini 注释掉#skip-grant-tables   
重启mysql服务，重新登陆就是新的密码了