1、法一
2、法二mysql -u root
mysql> set password for 'root'@'localhost' = password('newpass');
3、法三用update直接編輯user表
mysql -u root
mysql> use mysql;
mysql> update user set password = password('newpass') where user = 'root';
mysql> flush privileges;
4、授權使用者登入資料庫丟失root密碼的時候,可以這樣
mysqld_safe --skip-grant-tables&
mysql -u root mysql
mysql> update user set password=password("new password") where user='root';
mysql> flush privileges;
參考鏈結授權使用者,你想root使用密碼從任何主機連線到mysql伺服器
\grant all privileges on *.* to 'root'@'%' identified by 'admin123' with grant option;flush privileges;
如果你想允許使用者root從ip為192.168.12.16的主機連線到mysql伺服器
\grant all privileges on *.* to 'root'@'192.168.1.16' identified by '123456' with grant option;
mysql 修改密碼和授權
格式 mysql set password for 使用者名稱 host password 新密碼 例子 mysql set password for root localhost password 123456 必須以最高權力使用者來授權 比如root等 grant allon stumysql....
MYSQL強制修改密碼及遠端連線
即 vim etc my.cnf 或者 vi etc my.cnf 進入vim編輯模式編輯my.cnf檔案資訊 新增一條語句使其變為不用密碼就能進入的狀態 skip grant tables 如圖 2.進入到mysql後 執行以下語句 mysql update mysql.user set pass...
mysql開啟遠端登 Mysql開啟遠端登入
自己在工作中,需要配置mysql,並且需要遠端進行訪問。其中碰到的問題都是上網搜進行解決,但是很多人可能沒有我碰到的問題多,所以將自己解決配置中的問題記錄下來,以便幫助一些像我一樣對mysql和ubuntu都比較無措的人。我的系統是 ubuntu 12.04 32位。安裝 sudo apt get ...