Mysql 密碼修改 linux 忘記密碼 新建用戶 更新密碼 ...
#mysql -u root -p
#輸入資料庫密碼
#select user, host from mysql.user;
#SET PASSWORD FOR 'root'@'localhost' = PASSWORD('新密碼');//本地密碼
#SET PASSWORD FOR 'root'@'%' = PASSWORD('新密碼');//遠程密碼
#FLUSH PRIVILEGES;// 刷新生效
mysql 忘記密碼:(如果中間出錯, 就使用FLUSH PRIVILEGES命令)
#service mysqld stop //或者 #service mysql stop
#mysqld_safe --skip-grant-tables //進入到skip-grant-tables模式
#mysql
#use mysql
#SET PASSWORD FOR 'root'@'localhost' = PASSWORD('123456');//本地密碼
#SET PASSWORD FOR 'root'@'%' = PASSWORD('123456');//遠程密碼
#FLUSH PRIVILEGES;// 刷新生效
#ps -ef | grep mysql
#kill -9 mysql的id
#service mysqld start