系統(tǒng)軟件園 - 專注分享最好的電腦系統(tǒng)軟件!免費安全下載 系統(tǒng)軟件園首頁 | Win7激活工具 | 熱門專題
系統(tǒng)軟件園>您的位置:首頁 > > 系統(tǒng)教程 > Win10系統(tǒng)教程 >

Win10系統(tǒng)MySQL5.7密碼忘記怎么重置?

更新時間:2019-07-31 14:02:19| 編輯:本站整理 | 信息來源:本站整理|瀏覽數(shù):

在Win10系統(tǒng)下安裝了mySQL使用,有時遇到密碼忘記的問題也是挺遭心的,那么如何重置mysql密碼呢?下面小編就分享下具體教程。




Win10下mysql密碼重置步驟如下:


1、首先點擊開始菜單,搜索cmd.exe,左擊以管理員身份運行

操作之前先備份好數(shù)據(jù)庫(切忌)

C:\Users\Administrator>cd C:\Program Files\MySQL\MySQL Server 5.7\bin
C:\Program Files\MySQL\MySQL Server 5.7\bin>mysqld --skip-grants-tables
//發(fā)現(xiàn)不成功,原因是沒有data目錄,于是在此C:\Program Files\MySQL\MySQL Server 5.7目錄下創(chuàng)建了data目錄,成功執(zhí)行且可以跳過認證
//但是進入數(shù)據(jù)庫發(fā)現(xiàn)原來的庫都不見了,原來是默認情況下,MySQL的數(shù)據(jù)庫文件是保存在C:/ProgramData/mysql/MySQL Server 5.7/Data/ 而且,Win7,Win10缺省是把C:/ProgramData目錄隱藏的。
//因此我們需要指定配置文件來啟動
C:\Program Files\MySQL\MySQL Server 5.7\bin>mysqld --defaults-file="C:\ProgramData\MySQL\MySQL Server 5.7\my.ini" --user=mysql   --skip-grants-tables
 

//進入數(shù)據(jù)庫

C:\Program Files\MySQL\MySQL Server 5.7\bin>mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.7.21-log MySQL Community Server (GPL)

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

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>show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| ds_bi              |
| ixcrm              |
| karryofficial      |
| mysql              |
| performance_schema |
| sanya              |
| sys                |
| zyyguahao          |
+--------------------+
9 rows in set (0.00 sec)
mysql> use mysql;
Database changed
mysql> show tables;
+---------------------------+
| Tables_in_mysql           |
+---------------------------+
| columns_priv              |
| db                        |
| engine_cost               |
| event                     |
| func                      |
| general_log               |
| gtid_executed             |
| help_category             |
| help_keyword              |
| help_relation             |
| help_topic                |
| innodb_index_stats        |
| innodb_table_stats        |
| ndb_binlog_index          |
| plugin                    |
| proc                      |
| procs_priv                |
| proxies_priv              |
| server_cost               |
| servers                   |
| slave_master_info         |
| slave_relay_log_info      |
| slave_worker_info         |
| slow_log                  |
| tables_priv               |
| time_zone                 |
| time_zone_leap_second     |
| time_zone_name            |
| time_zone_transition      |
| time_zone_transition_type |
| user                      |
+---------------------------+
31 rows in set (0.00 sec)
mysql> desc user;
+------------------------+-----------------------------------+------+-----+-----------------------+-------+
| Field                  | Type                              | Null | Key | Default               | Extra |
+------------------------+-----------------------------------+------+-----+-----------------------+-------+
| Host                   | char(60)                          | NO   | PRI |                       |       |
| User                   | char(32)                          | NO   | PRI |                       |       |
| Select_priv            | enum('N','Y')                     | NO   |     | N                     |       |
| Insert_priv            | enum('N','Y')                     | NO   |     | N                     |       |
| Update_priv            | enum('N','Y')                     | NO   |     | N                     |       |
| Delete_priv            | enum('N','Y')                     | NO   |     | N                     |       |
| Create_priv            | enum('N','Y')                     | NO   |     | N                     |       |
| Drop_priv              | enum('N','Y')                     | NO   |     | N                     |       |
| Reload_priv            | enum('N','Y')                     | NO   |     | N                     |       |
| Shutdown_priv          | enum('N','Y')                     | NO   |     | N                     |       |
| Process_priv           | enum('N','Y')                     | NO   |     | N                     |       |
| File_priv              | enum('N','Y')                     | NO   |     | N                     |       |
| Grant_priv             | enum('N','Y')                     | NO   |     | N                     |       |
| References_priv        | enum('N','Y')                     | NO   |     | N                     |       |
| Index_priv             | enum('N','Y')                     | NO   |     | N                     |       |
| Alter_priv             | enum('N','Y')                     | NO   |     | N                     |       |
| Show_db_priv           | enum('N','Y')                     | NO   |     | N                     |       |
| Super_priv             | enum('N','Y')                     | NO   |     | N                     |       |
| Create_tmp_table_priv  | enum('N','Y')                     | NO   |     | N                     |       |
| Lock_tables_priv       | enum('N','Y')                     | NO   |     | N                     |       |
| Execute_priv           | enum('N','Y')                     | NO   |     | N                     |       |
| Repl_slave_priv        | enum('N','Y')                     | NO   |     | N                     |       |
| Repl_client_priv       | enum('N','Y')                     | NO   |     | N                     |       |
| Create_view_priv       | enum('N','Y')                     | NO   |     | N                     |       |
| Show_view_priv         | enum('N','Y')                     | NO   |     | N                     |       |
| Create_routine_priv    | enum('N','Y')                     | NO   |     | N                     |       |
| Alter_routine_priv     | enum('N','Y')                     | NO   |     | N                     |       |
| Create_user_priv       | enum('N','Y')                     | NO   |     | N                     |       |
| Event_priv             | enum('N','Y')                     | NO   |     | N                     |       |
| Trigger_priv           | enum('N','Y')                     | NO   |     | N                     |       |
| Create_tablespace_priv | enum('N','Y')                     | NO   |     | N                     |       |
| ssl_type               | enum('','ANY','X509','SPECIFIED') | NO   |     |                       |       |
| ssl_cipher             | blob                              | NO   |     | NULL                  |       |
| x509_issuer            | blob                              | NO   |     | NULL                  |       |
| x509_subject           | blob                              | NO   |     | NULL                  |       |
| max_questions          | int(11) unsigned                  | NO   |     | 0                     |       |
| max_updates            | int(11) unsigned                  | NO   |     | 0                     |       |
| max_connections        | int(11) unsigned                  | NO   |     | 0                     |       |
| max_user_connections   | int(11) unsigned                  | NO   |     | 0                     |       |
| plugin                 | char(64)                          | NO   |     | mysql_native_password |       |
| authentication_string  | text                              | YES  |     | NULL                  |       |
| password_expired       | enum('N','Y')                     | NO   |     | N                     |       |
| password_last_changed  | timestamp                         | YES  |     | NULL                  |       |
| password_lifetime      | smallint(5) unsigned              | YES  |     | NULL                  |       |
| account_locked         | enum('N','Y')                     | NO   |     | N                     |       |
+------------------------+-----------------------------------+------+-----+-----------------------+-------+
45 rows in set (0.00 sec)
mysql> select user,host,authentication_string from user;
+---------------+-----------+-------------------------------------------+
| user          | host      | authentication_string                     |
+---------------+-----------+-------------------------------------------+
| root          | localhost | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
| mysql.session | localhost | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE |
| mysql.sys     | localhost | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE |
| biyu          | %         | *EDC20FCB679DE26150946AA0D8FF74CE730128ED |
+---------------+-----------+-------------------------------------------+
4 rows in set (0.00 sec)
mysql> update user set authentication_string=password('123456') where user='root' and host='localhost';
mysql> flush privileges; #更新權(quán)限

//退出再使用新密碼登陸,上面的紅色密碼 root 等改成自己的用戶名和密碼
 

方法二:

mysql > set password for root@localhost = password('mysqlroot');

 

方法三:

mysqladmin -u UserName -h Host password 'new_password' -p



以上就是小編分享的在Win10系統(tǒng)下mySQL密碼忘記之后的重置方法了,希望大家能喜歡。

返回頂部


系統(tǒng)軟件園發(fā)布的系統(tǒng)鏡像及軟件均來至互聯(lián)網(wǎng),僅供學習和研究使用,不得用于任何商業(yè)用途并請在下載后24小時內(nèi)刪除,如果滿意請聯(lián)系版權(quán)方購買。
如果您發(fā)現(xiàn)本站侵害了您的版權(quán),請立即聯(lián)系我們,本站將第一時間進行相關(guān)處理。聯(lián)系方式(見首頁)
版權(quán)聲明|下載聲明 Copyright @ 2016 系統(tǒng)軟件園