MySQL涔嬪垵浣跨敤

Posted GrowthDBA

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了MySQL涔嬪垵浣跨敤相关的知识,希望对你有一定的参考价值。


浣跨敤瀹㈡埛绔▼搴弇ysql杩炴帴mysql



缃戜笂宸茬粡鏈夊緢澶歁ySQL瀹夎鏁欑▼锛屼笉鍐嶈禈杩帮紝鎴戜滑鐩存帴寮€鍚娇鐢ㄤ箣鏃咃紒姝ゆ枃绔犲唴瀹瑰€熼壌灏忓瀛?919銆奙ySQL鏄€庢牱浣跨敤鐨勶細浠庨浂馃寮€濮嬪涔燤ySQL銆嬨€併€奙ySQL鏄€庢牱杩愯鐨勶細浠庢牴涓婄悊瑙ySQL銆嬨€傛垜浣跨敤鐨凪ySQL鏄熀浜嶤entOS Linux release 7.5鎿嶄綔绯荤粺銆傚綋鎴戜滑鎶奙ySQL鏈嶅姟鍚姩璧锋潵涔嬪悗锛屽彲浠ョ洿鎺ラ€氳繃MySQL瀹夎鐩綍鐨刡in鐩綍涓嬬殑鍙墽琛屾枃浠?span>mysql鏉ヨ繘琛屽拰鏈嶅姟鍣ㄧ▼搴忕殑杩涚▼浜や簰锛屽惎鍔ㄨ繖涓彲鎵ц鏂囦欢鏃朵竴鑸渶瑕佷竴浜涘弬鏁帮細
mysql -h[涓绘満鍚峕  -u[鐢ㄦ埛鍚峕 -p[瀵嗙爜]

闄や簡涓婅堪鐨勫弬鏁伴€夐」澶栵紝杩樻湁寰堝锛屽垪涓句竴浜涘父瑙侀€夐」骞惰祴鍚箟锛?/span>

鍙傛暟锛堢煭褰㈠紡锛?/span> 鍚箟
-h 涓绘満鍚嶏紝琛ㄧず鍚姩MySQL鏈嶅姟绋嬪簭鐨勬湇鍔″櫒鍩熷悕鎴朓P鍦板潃锛屽鏋滄湇鍔$▼搴忓湪鏈満锛屽彲浠ョ渷鐣ユ寚瀹氾紝涔熷彲浠ュ~localhost鎴栬€?/span>127.0.0.1銆傚彲浠ュ啓浣滈暱褰㈠紡 --host=[涓绘満]銆?/span>
-u 鐢ㄦ埛鍚嶏紝鍙互鍐欎綔闀垮舰寮?nbsp;--user=[鐢ㄦ埛鍚峕銆?/span>
-p鈥?/span>鈥?/span> 瀵嗙爜锛屽彲浠ュ啓浣滈暱褰㈠紡 --password=[瀵嗙爜]銆?/span>
-P鈥?/span>鈥?/span> 绔彛锛屽彲浠ュ啓浣滈暱褰㈠紡 --port=[绔彛]銆?/span>
-D鈥?/span>鈥?/span> 搴撳悕锛屽彲浠ュ啓浣滈暱褰㈠紡 --database=[搴撳悕]銆?/span>
  • 鍙互浣跨敤涓嬮潰鐨勫懡浠ゅ惎鍔∕ySQL瀹㈡埛绔紝骞惰繛鎺ュ埌鏈嶅姟鍣細

mysql -hlocalhost -uroot -proot -P3306
# 鎴栬€?/span>
mysql --host=localhost --user=root --password=root --port=3306
  • 杩炴帴鎴愬姛鍚庣殑鐣岄潰锛?/span>

mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 8.0.21 Source distribution

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

[root@localhost][(none)]>


猸曪笍 灏忔彁绀?1


涓婅堪鐧诲綍鎴愬姛鐨勭晫闈腑鍑虹幇浜嗕竴鍙ヨ鍛婏細

mysql: [Warning] Using a password on the command line interface can be insecure.
璀﹀憡鎰忎负锛?span class="mq-111">鍦ㄥ懡浠よ鐣岄潰涓婁娇鐢ㄥ瘑鐮佸彲鑳戒笉瀹夊叏銆傚洜涓烘垜浠湪浣跨敤mysql鍛戒护鏃讹紝灏嗗瘑鐮佹樉绀虹殑杈撳叆鍦ㄥ懡浠よ涓紝杩欐牱濡傛灉瀵嗙爜钀藉埌蹇冩€€涓嶈建鐨勪汉鎵嬮噷锛屽悗鏋滀笉鍫鎯炽€傛墍浠ワ紝鍑轰簬瀹夊叏鑰冭檻锛屽簲浣跨敤濡備笅鏂瑰紡杩涜杩炴帴鏈嶅姟鍣ㄦ搷浣滐細
mysql -hlocalhost -uroot -p
# 鐐瑰嚮鍥炶溅涔嬪悗鎵嶄細鎻愮ず浣犺緭鍏ュ瘑鐮?/span>
Enter password:
# 杩欑鏂瑰紡浣犺緭鍏ョ殑瀵嗙爜涓嶄細琚樉绀哄嚭鏉ワ紝瀹夊叏寰椾互淇濊瘉

鍚屾椂锛岃繕鏄缓璁娇鐢ㄥ鏉傚瘑鐮侊紝鏇村姞瀹夊叏銆?/span>

MySQL涔嬪垵浣跨敤

猸曪笍 灏忔彁绀?2


濡傛灉浣犻潪瑕佸湪鏄惧紡鐨勬妸瀵嗙爜杈撳嚭鏉ワ紝閭e瘑鐮佸€煎拰-p涔嬮棿涓嶈兘鏈夌┖鐧藉瓧绗︼紝鍏朵粬鍙傛暟鍚嶄箣闂村彲浠ユ湁绌虹櫧瀛楃锛?/span>

mysql -h localhost -u root -proot
鍔犱笂浜嗙┖鐧藉瓧绗﹀氨鏄?/span>閿欒鐨勶細

mysql -h localhost -u root -p root

MySQL涔嬪垵浣跨敤

猸曪笍 灏忔彁绀?3


mysql鐨勫悇涓弬鏁扮殑鎽嗘斁椤哄簭娌℃湁纭€ц瀹氾紝鍙互杩欎箞鍐欙細

mysql -p -u root -h localhost

MySQL涔嬪垵浣跨敤

猸曪笍 灏忔彁绀?4


鏈嶅姟鍣ㄥ拰瀹㈡埛绔畨瑁呭湪鍚屼竴鍙版満鍣ㄤ笂锛?span class="mq-163">-h鍙傛暟鍙互鐪佺暐锛?/span>

mysql -u root -p

MySQL涔嬪垵浣跨敤

猸曪笍 灏忔彁绀?nbsp;5


濡傛灉浣跨敤鐨勬槸绫籙nix绯荤粺锛屽苟涓旂渷鐣?/span>-u鍙傛暟鍚庯紝浼氭妸浣犵櫥闄嗘搷浣滅郴缁熺殑鐢ㄦ埛鍚嶅綋浣淢ySQL鐨勭敤鎴峰悕鍘诲鐞嗐€傛瘮鏂圭櫥褰曟搷浣滅郴缁熺殑鐢ㄦ埛鍚嶆槸admin锛岄偅涔堝湪鏈哄櫒涓婁笅杈硅繖涓ゆ潯鍛戒护鏄瓑浠风殑锛?/span>
mysql -u admin -p
# 绛夊悓浜?/span>
mysql -p



鎵ц涓€浜涚畝鍗昐QL鍙婃敞鎰忎簨椤?/p>



缁忚繃婕暱鐨勮繛鎺ュ拰灏忔彁绀猴紝缁堜簬鍒颁簡婵€鍔ㄤ汉蹇冪殑鎵цSQL璇彞鐜妭锛屽啀鍥為【涓€涓嬩竵濂囧ぇ浣殑MySQL閫昏緫鏋舵瀯鍥撅細

MySQL涔嬪垵浣跨敤

  • 鍛戒护缁撴潫绗︼細
鍦ㄤ功鍐欏畬涓€涓懡浠や箣鍚庨渶瑕佷互涓嬭竟杩欏嚑涓鍙蜂箣涓€缁撳熬锛?/span>
;
\g
\G
  • 鏌ヨ褰撳墠鐧诲綍鐢ㄦ埛鐨勫懡浠わ細
[root@localhost][(none)]> SELECT USER();
+----------------+
| USER()         |
+----------------+
| root@localhost |
+----------------+
1 row in set (0.00 sec)

[root@localhost][(none)]> SELECT USER()\g
+----------------+
| USER()         |
+----------------+
| root@localhost |
+----------------+
1 row in set (0.00 sec)

[root@localhost][(none)]> SELECT USER()\G
*************************** 1. row ***************************
USER(): root@localhost
1 row in set (0.00 sec)

SELECT鎰忓懗鐫€杩欐槸涓€涓煡璇㈠懡浠わ紝USER()鏄疢ySQL鍐呯疆鐨勫嚱鏁帮紝鐢ㄤ簬杩斿洖褰撳墠鐧诲綍鐢ㄦ埛锛岀粨鏋滀腑1 row in set (0.00 sec)鐨勬剰鎬濇槸缁撴灉鍙湁1琛屾暟鎹紝鐢ㄦ椂0.00绉掋€傚叾涓儚USER()杩欐牱鐨勫嚱鏁拌繕鏈夊緢澶氾紝姣斿DATABASE()杩斿洖褰撳墠鎵€鎿嶄綔鐨勫簱鍚嶃€丯OW()杩斿洖褰撳墠鏃堕棿銆乂ERSION()杩斿洖褰撳墠MySQL鐗堟湰銆?span>锛?span class="mq-249">\G鏈変竴鐐圭壒娈婏紝瀹冨苟涓嶄互琛ㄦ牸鐨勫舰寮忚繑鍥炴煡璇㈢粨鏋滐紝鑰屾槸浠?span class="mq-250">鍨傜洿鐨勫舰寮忓皢姣忎釜鍒楅兘灞曠ず鍦ㄥ崟鐙殑涓€琛屼腑锛?/strong>

  • 鍛戒护娌℃湁缁撴潫涔嬪墠锛屽彲浠ラ殢鎰忔崲琛岋細
[root@localhost][(none)]> SELECT
    -> NOW()
    -> ;
+---------------------+
| NOW()               |
+---------------------+
| 2021-08-11 16:38:55 |
+---------------------+
1 row in set (0.00 sec)
骞朵笉鏄寜浜嗗洖杞﹂敭灏辨彁浜ゅ懡浠や簡锛屽彧瑕佹寜鍥炶溅閿殑鏃跺€欒緭鍏ョ殑璇彞閲屾病鏈?/span> ; 銆?/span> \g 鎴栬€?/span> \G 杩欎簺璇彞缁撴潫绗﹀彿锛岃璇彞灏辩畻鏄病缁撴潫銆?/span>
  • 鍙互涓€娆℃彁浜ゅ涓懡浠わ細
[root@localhost][(none)]> SELECT NOW(); SELECT USER(); SELECT DATABASE();
+---------------------+
| NOW()               |
+---------------------+
| 2021-08-11 16:39:50 |
+---------------------+
1 row in set (0.00 sec)

+----------------+
| USER()         |
+----------------+
| root@localhost |
+----------------+
1 row in set (0.00 sec)

+------------+
| DATABASE() |
+------------+
| NULL       |
+------------+
1 row in set (0.00 sec)
杩炵潃杈撳叆浜?涓煡璇㈠綋鍓嶆椂闂寸殑鍛戒护锛屽彧瑕佹病鎸夊洖杞﹂敭锛屽氨涓嶄細鎻愪氦鍛戒护銆?/span>
  • 浣跨敤 \c 鏀惧純鏈鎿嶄綔锛?/span>
[root@localhost][(none)]> SELECT NOW()\c
[root@localhost][(none)]>
濡傛灉涓嶄娇鐢╘c锛岄偅瀹㈡埛绔細浠ヤ负杩欐槸涓€涓琛屽懡浠わ紝杩樺湪涓€鐩村偦鍌荤殑绛変綘杈撳叆鍛戒护锝?/span>
  • MySQL榛樿瀵瑰懡浠ょ殑澶у皬鍐欏苟娌℃湁闄愬埗锛岃繖鏍锋煡璇篃鍙互锛?/span>

[root@localhost][(none)]> select database();
+------------+
| database() |
+------------+
| NULL       |
+------------+
1 row in set (0.00 sec)
涓轰簡瑙勮寖璧疯锛岃繕鏄缓璁皢鍏抽敭瀛楀 SELECT 銆?/span> FROM 銆?/span> WHERE 绛夊ぇ鍐欙紝搴撳悕銆佽〃鍚嶃€佸瓧娈靛悕灏忓啓銆?/span>
  • 瀛楃涓茬殑琛ㄧず銆傚湪鍛戒护閲屾湁鏃朵細浣跨敤鍒板瓧绗︿覆锛屾垜浠彲浠ヤ娇鐢ㄥ崟寮曞彿''鎴栬€呭弻寮曞彿""鎶婂瓧绗︿覆鍐呭寮曡捣鏉?/span>
[root@localhost][(none)]> SELECT 'mysql';
+-------+
| mysql |
+-------+
| mysql |
+-------+
1 row in set (0.00 sec)

[root@localhost][(none)]> SELECT "mysql";
+-------+
| mysql |
+-------+
| mysql |
+-------+
1 row in set (0.00 sec)
  • 杩欎釜璇彞鍙槸绠€鍗曠殑鎶婂瓧绗︿覆'mysql'鍙堣緭鍑烘潵浜嗚€屽凡銆備絾涓€瀹氳鍦ㄥ瓧绗︿覆鍐呭涓婂姞涓婂紩鍙凤紝涓嶇劧鐨勮瘽MySQL鏈嶅姟鍣ㄤ細鎶婂畠褰撲綔鍒楀悕锛屾瘮濡傝繖鏍峰氨浼氳繑鍥炰竴涓敊璇細

[root@localhost][(none)]> SELECT mysql;
ERROR 1054 (42S22): Unknown column 'mysql' in 'field list'
[root@localhost][(none)]>
  • \s 鑾峰彇MySQL鏈嶅姟鍣ㄧ殑鐘舵€佷俊鎭細

MySQL涔嬪垵浣跨敤

閫氳繃 \s 鍛戒护鍙互鑾峰彇鍒板綋鍓嶄細璇滻D銆佸綋鍓嶇敤鎴枫€佸綋鍓嶇殑MySQL鐗堟湰銆佸瓧绗︾紪鐮併€丮YSQL鏈嶅姟杩愯鐨勬椂闀裤€佸綋鍓嶇嚎绋嬫暟銆佹墦寮€鐨勮〃鏁伴噺绛変俊鎭€?/span>
  • \!鍦∕ySQL鍛戒护琛屼腑鎵цLinux鎿嶄綔绯荤粺鍛戒护锛?/span>
[root@localhost][(none)]> \! pwd
/mysql/mysql3306
[root@localhost][(none)]>
  • 鏂紑瀹㈡埛绔笌鏈嶅姟鍣ㄧ殑杩炴帴骞朵笖鍏抽棴瀹㈡埛绔殑璇濓紝鍙互浣跨敤涓嬮潰鐨勫懡浠わ細

[root@localhost][(none)]> exit
Bye
[root@localhost][(none)]> quit
Bye
[root@localhost][(none)]> \q
Bye
  • SHOW ENGINES;鏌ョ湅MySQL鏀寔鐨勫瓨鍌ㄥ紩鎿庯細

[root@localhost][(none)]> SHOW ENGINES;
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| Engine             | Support | Comment                                                        | Transactions | XA   | Savepoints |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| FEDERATED          | YES     | Federated MySQL storage engine                                 | NO           | NO   | NO         |
| MEMORY             | YES     | Hash based, stored in memory, useful for temporary tables      | NO           | NO   | NO         |
| InnoDB             | DEFAULT | Supports transactions, row-level locking, and foreign keys     | YES          | YES  | YES        |
| PERFORMANCE_SCHEMA | YES     | Performance Schema                                             | NO           | NO   | NO         |
| MyISAM             | YES     | MyISAM storage engine                                          | NO           | NO   | NO         |
| MRG_MYISAM         | YES     | Collection of identical MyISAM tables                          | NO           | NO   | NO         |
| BLACKHOLE          | YES     | /dev/null storage engine (anything you write to it disappears) | NO           | NO   | NO         |
| CSV                | YES     | CSV storage engine                                             | NO           | NO   | NO         |
| ARCHIVE            | YES     | Archive storage engine                                         | NO           | NO   | NO         |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
9 rows in set (0.00 sec)
  • SHOW 鍛戒护鍚庨潰鍙互 璺熷緢澶氶€夐」 锛屾潵鏄剧ず涓嶅悓鐨勫姛鑳斤紝濡?/span> PLUGINS 鑾峰彇褰撳墠鎵€鏈夋椿璺冪殑鎻掍欢銆?/span> VARIABLES 鑾峰彇MySQL鏈嶅姟鍣ㄦ墍鏈夌殑鍙傛暟銆?/span> STATUS 鑾峰彇MySQL鏈嶅姟鍣ㄧ姸鎬佷俊鎭€?/span> ERRORS 鑾峰彇閿欒淇℃伅銆?/span> WARNINGS 鑾峰彇璀﹀憡淇℃伅銆?/span> GRANTS 鑾峰彇褰撳墠鐢ㄦ埛鐨勬巿鏉冧俊鎭瓑锛屽悓鏃讹紝 VARIABLES銆丼TATUS 鍙互閫氳繃 LIKE 鍏抽敭瀛楁潵鍖归厤鎯宠鐨勪釜鍒弬鏁帮細
[root@localhost][(none)]> SHOW STATUS LIKE 'Threads_running';
+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| Threads_running | 2     |
+-----------------+-------+
1 row in set (0.00 sec)

[root@localhost][(none)]> SHOW VARIABLES LIKE 'sql_mode';
+---------------+--------------------------------------------+
| Variable_name | Value                                      |
+---------------+--------------------------------------------+
| sql_mode      | STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION |
+---------------+--------------------------------------------+
1 row in set (0.01 sec)
鍙互SHOW鐨勫唴瀹规湁寰堝锛屽ぇ瀹跺彲浠ュ灏濊瘯鎿嶄綔涓€涓?/span> MySQL涔嬪垵浣跨敤 銆?/span>


MySQL涔嬪垵浣跨敤

猸曪笍 灏忔彁绀?/span>


鍦∕ySQL瀹㈡埛绔墽琛岃繃鐨勫懡浠わ紝浼氬湪Linux鎿嶄綔绯荤粺涓婃湁鎵€淇濆瓨锛屽瓨鍌ㄥ湪褰撳墠Linux鐢ㄦ埛鐨勫鐩綍涓嬬殑.mysql_history闅愯棌鏂囦欢閲岋細

[172.xx.x.xxx:root@sz-pg-backup-zookeeper-003:/root]# cd ~
[172.xx.x.xxx:root@sz-pg-backup-zookeeper-003:/root]# tail -n 8 .mysql_history
SELECT\040'mysql';
SELECT\040mysql;
\134s
\134!\040pwd
SHOW\040ENGINES;
SHOW\040STATUS\040LIKE\040'Threads_running';
SHOW\040VARIABLES\040LIKE\040'sql_mode';
exit
[172.xx.x.xxx:root@sz-pg-backup-zookeeper-003:/root]#
鍙互鐪嬪埌锛屽垰鎵嶆墽琛岃繃鐨凷QL閮戒細璁板綍鍦ㄨ繖涓枃浠讹紝璇ユ枃浠朵腑锛屾湁鍑犱釜鍦版柟闇€瑕佹敞鎰忥細SQL鍛戒护涓殑' [绌烘牸] '杞崲鎴愪簡 \040 銆? \ '杞崲鎴愪簡 \134 銆?/span>



鏌ョ湅鏁版嵁搴撳拰琛?span class="mq-610">



缁忚繃涓婇潰瀵规暟鎹簱鐨勪竴浜涚畝鍗昐QL浣跨敤锛屼簡瑙d簡鏁版嵁搴撲竴浜涚畝鍗曟搷浣滐紝涓嬮潰姝e紡杩涘叆搴撳拰琛ㄧ殑淇℃伅鏌ヨ銆?/span>
  • 鑾峰彇褰撳墠MySQL瀹炰緥涓墍鏈夌殑鏁版嵁搴擄細
[root@localhost][(none)]> SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
| test_clone         |
+--------------------+
5 rows in set (0.00 sec)
SHOW DATABASES; 杩斿洖涓€涓彲鐢ㄦ暟鎹簱鍒楄〃锛屽叾涓?/span> information_schema 銆?/span> performance_schema 銆?/span> mysql 銆?/span> sys 鏄疢ySQL鍐呴儴浣跨敤鐨勬暟鎹簱锛屽浘涓?/span> test_clone 涓烘垜浠嚜宸卞垱寤虹殑搴撱€?/span>
  • 閫夋嫨瑕佹搷浣滅殑鏁版嵁搴擄紙褰撴垜浠鎿嶄綔鏌愪竴涓暟鎹簱鏃讹紝闇€瑕佸厛鍒囨崲鍒板搴旂殑搴撲笅锛夛細

[root@localhost][(none)]> USE mysql;
Database changed
[root@localhost][mysql]> SELECT DATABASE();
+------------+
| DATABASE() |
+------------+
| mysql      |    
+------------+
1 row in set (0.00 sec)
USE 璇彞涓嶄細杩斿洖浠讳綍缁撴灉锛屼緷璧栦娇鐢ㄧ殑瀹㈡埛鏈猴紝鏄剧ず鏌愮褰㈠紡鐨勯€氱煡锛?/span> Database changed 杩欎釜娑堟伅灏辨槸mysql鍛戒护琛屽疄鐢ㄧ▼搴忓湪鏁版嵁搴撻€夋嫨鎴愬姛鍚庢樉绀虹殑娑堟伅锛?/span> SELECT DATABASE(); 纭涓€涓嬫垜浠綋鍓嶉€夋嫨鐨勫簱鏄惁姝g‘銆?/span>
  • 鏌ョ湅鍒涘缓鏁版嵁搴撶殑璇彞锛?/span>

[root@localhost][mysql]> SHOW CREATE DATABASE mysql;
+----------+---------------------------------------------------------------------------------------------------------------------------------+
| Database | Create Database                                                                                                                 |
+----------+---------------------------------------------------------------------------------------------------------------------------------+
| mysql    | CREATE DATABASE `mysql` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */ |
+----------+---------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
  • 鏌ョ湅鏌愪竴涓暟鎹簱鍐呯殑鎵€鏈夎〃鐨勫垪琛細

[root@localhost][mysql]> SHOW TABLES;
+---------------------------+
| Tables_in_mysql           |
+---------------------------+
| columns_priv              |
| component                 |
| db                        |
| default_roles             |
| engine_cost               |
| func                      |
| general_log               |
| global_grants             |
| gtid_executed             |
| help_category             |
| help_keyword              |
| help_relation             |
| help_topic                |
| innodb_index_stats        |
| innodb_table_stats        |
| password_history          |
| plugin                    |
| procs_priv                |
| proxies_priv              |
| role_edges                |
| 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                      |
+---------------------------+
33 rows in set (0.00 sec)
  • 鏌ョ湅鏌愬紶琛ㄧ殑鎵€鏈夊瓧娈典俊鎭細

[root@localhost][mysql]> SHOW COLUMNS FROM db;
+-----------------------+---------------+------+-----+---------+-------+
| Field                 | Type          | Null | Key | Default | Extra |
+-----------------------+---------------+------+-----+---------+-------+
| Host                  | char(255)     | NO   | PRI |         |       |
| Db                    | char(64)      | 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       |       |
| 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       |       |
| Create_tmp_table_priv | enum('N','Y') | NO   |     | N       |       |
| Lock_tables_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       |       |
| Execute_priv          | enum('N','Y') | NO   |     | N       |       |
| Event_priv            | enum('N','Y') | NO   |     | N       |       |
| Trigger_priv          | enum('N','Y') | NO   |     | N       |       |
+-----------------------+---------------+------+-----+---------+-------+
22 rows in set (0.01 sec)


MySQL涔嬪垵浣跨敤

猸曪笍 灏忔彁绀?/span>


鎯宠繘涓€姝ヤ簡瑙?/span> SHOW 锛屽湪MySQL鍛戒护琛岃緭鍏?/span> HELP SHOW;



灏忕粨



鏈珷浠嬬粛浜嗗浣曡繛鎺ュ拰鐧诲綍MySQL锛屽浣曚娇鐢ㄧ畝鍗曠殑SQL鍛戒护鏉ヨ幏鍙栨暟鎹簱鐨勪竴浜涗俊鎭紝濡備綍鐢║SE閫夋嫨鏁版嵁搴擄紝濡備綍鐢⊿HOW鏌ョ湅MySQL鏁版嵁搴撱€佽〃鍜屽唴閮ㄤ俊鎭瓑銆傛湰绔犺緝涓哄熀纭€锛屼负鍚庨潰鐨勬繁鍏ュ涔犲瀹氫簡鍩虹銆?/span>




end


以上是关于MySQL涔嬪垵浣跨敤的主要内容,如果未能解决你的问题,请参考以下文章

鏁版嵁搴撲箣MySQL鐨勪粙缁嶄笌浣跨敤20180703

濡備綍浣跨敤eclipse浣跨敤Maven

濡備綍鎻愰珮绋嬪簭鍛樼殑閿洏浣跨敤鐜囷紵

window10Cmd浣跨敤

SpringCloudConfig浣跨敤