更改root密碼和恢複mysql教程 root使用者
我不小心刪除了mysql的root帳號。我該怎麼辦?"和"我失去了我的根密碼?這種問題經碰到,那麼你碰這類問題時是備份資料,重新安裝mysql和恢複所有資料庫教程檔案?還是怎麼辦,我們現在為你找到一個更好的辦法。
1、停止mysql ,
2、伺服器許可權
c:www.111cn.netbinmysqld-nt.exe --skip-grant-tables
where c:www.111cn.net is mysql'instalation directory.
如果是linux就如下執行命令
/usr/local/mysql/bin/mysqld_safe --skip-grant-tables --user=root --skip-networking
3、串連到伺服器使用exsisting帳戶(root或某些otherif root帳戶被刪除)。
c:www.111cn.netbinmysql.exe -u user
or
/usr/local/mysql/bin/mysql -u user
4、更改mySQL 查詢密碼
update mysql.user set password=password('newpwd') where user='root';
or recreating user:
create user root identified by password 'newpwd';
grant all privileges on * . * to 'root'@ 'localhost' identified by 'newpwd' with grant option max_queries_per_hour 0 max_connections_per_hour 0 max_updates_per_hour 0 max_user_connections 0 ;
5、重新整理許可權
flush privileges;
6、重新啟動伺服器
ok mysql root密碼就被你找回來了哈。