Forget MySQL Password_MySQL
0. Environment
Ubuntu 12.04 x64 server
MySQL 5.5.29
1. Steps
1.1 Modify your MySQL's "my.cnf" file, and add a line in "[mysqld]" session:
skip-grant-tables
1.2 Restart MySQL
1.3 Log in MySQL without password
$ bin/mysql -u root -p
press enter when the command shows "Enter password:"
1.4 Select database
mysql> use mysql;
1.5 Updata password
mysql> update user set password = password('mypass') where user = 'root';
1.6 Refresh tables related with system permissionmysql> flush privileges;
1.7 Modify your MySQL's "my.cnf" file to original version, delete the following line in "[mysqld]" session:skip-grant-tables
1.8 Restart MySQL
2. References
http://www.cnblogs.com/allenblogs/archive/2010/08/12/1798247.html
(This article is from http://www.cnblogs.com/chenyineng/archive/2013/04/30/3051959.html, and belongs to http://chenyineng.cnblogs.com and http://www.chenyineng.info)
bitsCN.com推荐阅读
-
MySQL中decimal类型用法的简单介绍
-
MYSQL本地安装以及出现的问题解决
-
MySQL使用命令创建、删除、查询索引的介绍
-
mysql 8.0.15 安装配置图文教程
-
如何提高MySQL Limit查询性能的方法详解
-
MySQL5.7中的JSON基本操作指南
-
mysql 8.0.15 安装配置方法图文教程
-
win10下MySQL 8.0登录Access denied for user‘root’@‘localhost’ (using password: YES)问题的解决方法
-
win10下mysql 8.0.12 安装及环境变量配置教程
-
Mysql主从数据库(Master/Slave)同步配置与常见错误