首頁 > 資料庫 > mysql教程 > Forget MySQL Password_MySQL

Forget MySQL Password_MySQL

WBOY
發布: 2016-06-01 13:35:14
原創
873 人瀏覽過

bitsCN.com

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
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板