溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

Linux基礎(chǔ)命令---mysql

發(fā)布時(shí)間:2020-08-08 02:42:12 來源:ITPUB博客 閱讀:135 作者:一生有你llx 欄目:建站服務(wù)器

mysql

mysql 是一個(gè)簡(jiǎn)單的sql shell,它可以用來管理mysql數(shù)據(jù)庫(kù)。

此命令的適用范圍:RedHat、RHEL、Ubuntu、CentOS、Fedora。

 

1 、語(yǔ)法

mysql [options]  db 

 

2 、參數(shù)列表

選項(xiàng)

說明

- ? | --help

顯示幫助信息

--auto-rehash

激活自動(dòng)rehash功能

--bind-address = ip

綁定ip,當(dāng)電腦有多個(gè)網(wǎng)卡的時(shí)候,可以指定mysql連接時(shí)的網(wǎng)卡

--character-sets-dir  =  path

指定字符集所在的目錄

--column-names

在結(jié)果中顯示列名

-C | --comments

在發(fā)送給服務(wù)器的狀態(tài)中顯示注釋

-c | --compress

在服務(wù)器和客戶端之間的數(shù)據(jù)進(jìn)行壓縮

-D   db  |  --database = db

指定數(shù)據(jù)庫(kù)名

--default-character-set = chatset

默認(rèn)的字符集

-e   statement  |  --execute = statement

指定要使用的指令

-f | --force

強(qiáng)制執(zhí)行

-H | --html

輸出html格式

-i | --ignore-spaces

忽略空格

--line-numbers

為錯(cuò)誤信息顯示行號(hào)

--local-infile=0|1

關(guān)閉或者開啟LOAD DATA INFILE功能

-A | --no-autp-rehash

關(guān)閉自動(dòng)rehash功能

-b | --no-beep

關(guān)閉出錯(cuò)提醒

-p   password  |  --password =

連接數(shù)據(jù)庫(kù)使用的密碼

-W | --pipe

使用有名管道連接數(shù)據(jù)庫(kù)

-P   port  |  --port =

連接數(shù)據(jù)庫(kù)使用的端口

-- protocol = TCP|SOCKET|PIPI|MEMORY

連接數(shù)據(jù)庫(kù)使用的協(xié)議

-q | --quick

不緩存查詢結(jié)果

-s | --silent

輸出簡(jiǎn)短的內(nèi)容

-v | --verbose

顯示詳細(xì)執(zhí)行過程

-V | --version

顯示版本信息

-w | --wait

等待時(shí)間

-X | --xml

產(chǎn)生xml輸出

-u   user  |  --user =

連接數(shù)據(jù)庫(kù)的用戶名,默認(rèn)是rootq

 

3 、實(shí)例

1 )登錄

[root@localhost ~]#  mysql -u root –p             // 使用用戶 root 連接數(shù)據(jù)庫(kù)

Enter password: 

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 5

Server version: 5.1.71 Source distribution

 

Copyright (c) 2000, 2013, 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> quit           // 退出

Bye

2 )查看權(quán)限

mysql>  show privileges;

+-------------------------+---------------------------------------+-------------------------------------------------------+

| Privilege               | Context                               | Comment                                              |

+-------------------------+---------------------------------------+-------------------------------------------------------+

| Alter                   | Tables                                | To alter the table                                    |

| Alter routine           | Functions,Procedures                  | To alter or drop stored functions/procedures          |

| Create                  | Databases,Tables,Indexes              | To create new databases and tables                    |

| Create routine          | Databases                             | To use CREATE FUNCTION/PROCEDURE                      |

| Create temporary tables | Databases                             | To use CREATE TEMPORARY TABLE                         |

| Create view             | Tables                                | To create new views                                   |

| Create user             | Server Admin                          | To create new users                                   |

| Delete                  | Tables                                | To delete existing rows                               |

| Drop                    | Databases,Tables                      | To drop databases, tables, and views                  |

| Event                   | Server Admin                          | To create, alter, drop and execute events             |

| Execute                 | Functions,Procedures                  | To execute stored routines                            |

| File                    | File access on server                 | To read and write files on the server                 |

| Grant option            | Databases,Tables,Functions,Procedures | To give to other users those privileges you possess   |

| Index                   | Tables                                | To create or drop indexes                             |

| Insert                  | Tables                                | To insert data into tables                            |

| Lock tables             | Databases                             | To use LOCK TABLES (together with SELECT privilege)   |

| Process                 | Server Admin                          | To view the plain text of currently executing queries |

| References              | Databases,Tables                      | To have references on tables                          |

| Reload                  | Server Admin                          | To reload or refresh tables, logs and privileges      |

| Replication client      | Server Admin                          | To ask where the slave or master servers are          |

| Replication slave       | Server Admin                          | To read binary log events from the master             |

| Select                  | Tables                                | To retrieve rows from table                           |

| Show databases          | Server Admin                          | To see all databases with SHOW DATABASES              |

| Show view               | Tables                                | To see views with SHOW CREATE VIEW                    |

| Shutdown                | Server Admin                          | To shut down the server                               |

| Super                   | Server Admin                          | To use KILL thread, SET GLOBAL, CHANGE MASTER, etc.   |

| Trigger                 | Tables                                | To use triggers                                       |

| Update                  | Tables                                | To update existing rows                               |

| Usage                   | Server Admin                          | No privileges - allow connect only                    |

+-------------------------+---------------------------------------+-------------------------------------------------------+

29 rows in set (0.00 sec)

 

 

     

      做了一個(gè)Linux學(xué)習(xí)的平臺(tái),目前出來一個(gè)雛形,各位可以參考使用

      鏈接:https://pan.baidu.com/s/1GOLVU2CbpBNGtunztVpaCQ  密碼:n7bk 

      Linux基礎(chǔ)命令---mysql


向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI