主頁 > 知識庫 > 如何查看MySQL連接的root密碼

如何查看MySQL連接的root密碼

熱門標(biāo)簽:地圖簡圖標(biāo)注 南通電銷外呼系統(tǒng)哪家強(qiáng) 東莞外呼企業(yè)管理系統(tǒng) 如何選擇優(yōu)質(zhì)的外呼系統(tǒng) 沈陽智能外呼系統(tǒng)供應(yīng)商 桂林云電銷機(jī)器人收費(fèi) 手機(jī)外呼系統(tǒng)違法嗎 清遠(yuǎn)申請400電話 谷歌地圖標(biāo)注位置圖解

本文給大家分享的是查看MySQL連接的root密碼的方法,下面話不多說來來看正文:

1.首先我們進(jìn)到MySQL的bin目錄下

➜ cd /usr/local/mysql/bin

2.切換成root身份

➜ bin sudo su

3.跨過權(quán)限的驗(yàn)證

sh-3.2# ./mysqld_safe --skip-grant-tables 
[1] 9451
sh-3.2# 2017-01-03T15:40:10.6NZ mysqld_safe Logging to '/usr/local/mysql/data/yzydeMacBook-Pro.local.err'.
2017-01-03T15:40:10.6NZ mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data

4.以root身份登錄MySQL

./mysql -uroot
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.12 MySQL Community Server (GPL)

Copyright (c) 2000, 2016, 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.

5.選擇mysql數(shù)據(jù)庫

mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed

6.顯示mysql數(shù)據(jù)庫下的表

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)

7.很明顯我們需要的密碼是存在user這個表下的,所以我們直接看user的表結(jié)構(gòu)是怎么樣的

mysql> show columns from 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.02 sec)

8.表的內(nèi)容比較多,但是我們很容易就發(fā)現(xiàn),密碼其實(shí)是存在authentication_string字段下的,那我們就可以直接讀User內(nèi)容為root的密碼了

mysql> select authentication_string from user where User='root';
+-------------------------------------------+
| authentication_string      |
+-------------------------------------------+
| *781D25322166DB7FF99BA4A1FA5ED30439A60DDE |
+-------------------------------------------+
1 row in set (0.01 sec)

OK,那我們拿著這個密碼到Navicat試試看

 

總結(jié)

好了,以上就是這篇文章的全部內(nèi)容了,希望本文的內(nèi)容對大家的學(xué)習(xí)或者工作能帶來一定的幫助,如果有疑問大家可以留言交流。

您可能感興趣的文章:
  • MySQL——修改root密碼的4種方法(以windows為例)
  • MySQL密碼忘了怎么辦?MySQL重置root密碼方法
  • windows下mysql忘記root密碼的解決方法
  • Mysql的Root密碼忘記,查看或修改的解決方法(圖文介紹)
  • MySQL修改root密碼的多種方法(推薦)
  • Mysql5.7忘記root密碼及mysql5.7修改root密碼的方法
  • Mysql 忘記root密碼的完美解決方法
  • 安裝mysql8.0.11及修改root密碼、連接navicat for mysql的思路詳解
  • MySQL修改root密碼的4種方法(小結(jié))
  • Windows10系統(tǒng)下Mysql8.0.13忘記root密碼的操作方法

標(biāo)簽:重慶 臨沂 常德 內(nèi)蒙古 成都 貴州 天津 湖州

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《如何查看MySQL連接的root密碼》,本文關(guān)鍵詞  如何,查看,MySQL,連接,的,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《如何查看MySQL連接的root密碼》相關(guān)的同類信息!
  • 本頁收集關(guān)于如何查看MySQL連接的root密碼的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章