環境:linux;mysql5.7
mysql密碼忘記:
[root@izwz9f40l0qo5cpnn8qwmpz ~]# mysql -u root -p
enter password:
error 1045 (28000): access denied for user 'root'@'localhost' (using password: no)
檢視當前版本:
# rpm -qa |grep mysql
mysql57-community-release-el7-7.noarch
mysql-community-client-5.7.20-1.el7.x86_64
mysql-community-libs-5.7.20-1.el7.x86_64
mysql-community-common-5.7.20-1.el7.x86_64
mysql-community-server-5.7.20-1.el7.x86_64
停止mysql服務:
# service mysql stop
shutting down mysql.. success!
使用 mysqld_safe --skip-grant-tables:(啟動時不啟動grant-tables,授權表)
# mysqld_safe --skip-grant-tables
171114 13:45:27 mysqld_safe logging to '/usr/local/mysql/var/izwz9f40l0qo5cpnn8qwmpz.err'.
171114 13:45:27 mysqld_safe starting mysqld daemon with databases from /usr/local/mysql/var
然後就可以不用密碼來登入mysql了:
# mysql
welcome to the mysql monitor. commands end with ; or \g.
your mysql connection id is 1
server version: 5.6.36-log source distribution
oracle is a registered trademark of oracle corporation and/or its
affiliates. other names may be trademarks of their respective
owners.
type 'help;' or '\h' for help. type '\c' to clear the current input statement.
重置mysql密碼:
mysql>update user set password=password("123456789")where user="root"
重新整理許可權:
mysql>flush privileges;
密碼修改完成!
mysql 怎麼辦 mysql 密碼忘記怎麼辦
一 若資料庫是初次登陸 linux系統給資料庫生成了乙個原始密碼在檔案 var log mysqld.log中 grep temporary password var log mysqld.log 找到原始密碼 登陸 mysql uroot p 你找到的密碼 mysql set global val...
mysql忘記了root密碼該怎麼辦?
如果不重新安裝mysql,忘記了root密碼,該如何處理呢?親測有效 1.在任務管理器中關閉含有sql關鍵字的程序 2.使用管理員方式開啟命令列,定位到mysql安裝bin目錄下 3.命令列輸入 net stop mysql 4.命令列輸入 mysqld console skip grant tab...
mysql忘記密碼怎麼辦?
mysql忘記密碼怎麼辦?windows 1.用系統管理員登陸系統。2.停止mysql的服務。3.進入命令視窗,然後進入mysql的安裝目錄,比如我的安裝目錄是c mysql,進入c mysqlbin 4.跳過許可權檢查啟動mysql,c mysqlbin mysqld nt skip grant ...