Introduction to the common commands of MySQL basics

mysql learning column introduces basic common commands


Related free learning recommendations: mysql learning (video)

mysql command introduction
mysql is a database management command

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

View via mysql --help Related parameters and instructions for use

 

mysql --help  

 

            #mysql database management command

 

Usage: mysql [OPTIONS] [database]   

 

            #Syntax format

 

--help

 

#View help file-- auto-rehash                           

 

           #Auto-complete function-

 

A, --no-auto-rehash #No               

 

           need to auto-complete-

 

B, - batch #Do                              

 

       not use historical files, disable interaction

 

--

 

         character -sets-dir=name #Character     set installation directory-

 

C, --compress #When the                

 

 client and server transfer information, compress

 

-#--debug[=#]                       

 

         #call Function

 

-D, --database=name    #Use

 

         database

 

--default-character-set=name #Set the

 

         default character set

 

-e, --execute=name #Execute            

 

         sql statement

 

-E, --vertical                        

 

#Vertical         print output information-

 

f, --force                             #Skip the

 

        error, execute the following command

 

-G, --named-commands #Query

 

        results are printed in columns-

 

i, --ignore-spaces              #Ignore    

 

        spaces-

 

h, - name = Host               

 

         # set the connection address of the server and the IP

 

--line-numbers                 

 

        # display error line number

 

-L, --skip-line-numbers    

 

        # ignore the error line number

 

-n, --unbuffered               

 

        # each execution Refresh the cache after sql

 

--column-names #Display

 

        column information during query-

 

N, --skip-column-names  #Do              

 

        not display column information-

 

p, --password[=name] #Enter    

 

        password information-

 

P, --port =#                      

 

       #Set port information

 

    --prompt=name #set

 

       mysql prompt

 

    --protocol=name          #set          

 

       use protocol

 

-s, --silent #output                   

 

      line by line, tab interval

 

-S, --socket=name #connect     

 

      server to use socket file

 

-t,- -table #Output

 

      in tabular format

 

-u, --user=name #User                     name to           

 

      connect to the server

 

-v, --verbose                   #Print

 

      the command executed by sql

 

-V, --version                   #Output

 

      version information

 

-w, --wait                      #The

 

     time to wait for restart after the server stops--

 

connect-timeout=# #The time

 

     to wait before connecting-- max-

 

allowed-packet=#          #The            

 

maximum length of the server to send and receive packets

 

--show-warnings                

 



#Display     warning information The mysqldump command introduces the
mysqldump data backup command (logical backup)

, one of the most frequently used daily commands. It is also a commonly used database backup command for small and medium-sized enterprises or when the amount of data is small. It is very practical.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

mysqldump --help         

 

#mysql database backup Command (logical backup)

 

Usage: mysqldump [OPTIONS] database [tables]                  

 

mysqldump [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...]

 

mysqldump [OPTIONS] --all-databases [OPTIONS] #Backup

 

         command format

 

--print-defaults                #Print the

 

     default program parameter list

 

--no- defaults                    #Do

 

    not output default option parameters

 

--defaults-file=# #Set the

 

    specified option parameter file-

 

A, --all-databases           #All             

 

    databases--

 

add-drop-database       #Add

 

drop database statement before creating data

 

--add -locks #Add   

 

lock tables before exporting each table and unlock tables afterwards

 

--character-sets-dir           #Character

 

   set file directory

 

--compact #Export

 

    less output information

 

-B --databases #Specify

 

database

 

--debug-info #Output

 

debugging information and exit--

 

default-character-set 

 



 

#Set the default character set, the default is utf8 --dump-slave #Append        

 

the main binlog location and file name to the exported data file

 

--events,-E #Backup

 

   event information--

 

flush-logs,-F #After  

 

   backup refresh log

 

-p, --password [= name]

 

   # connection database password

 

-P, --port = #

 

   # set port information

 

-S, --socket name =

 

   # connecting to the server socket file

 

-V, --version

 

    # output Version information

 

-u, --user=name #User name to

 

   connect to the server.

Introduction to the mysqlbinlog command.
mysqlbinlog is a command used to view the information of the binlog binary log file. It is also one of the frequently used commands in daily life. It is usually used when restoring database data.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

. 17

18 is

. 19

20 is

21 is

22 is

23 is

24

25

26 is

27

28

29

30

31 is

32

33 is

34 is

35

36

37 [

38 is

39

the mysqlbinlog --help             

 

# View binlog mysql the log file records

 

the Usage: the mysqlbinlog [Options] log-Files  

 

      # syntax

 

- -character-sets-dir=name        #Specify the

 

        character set file directory

 

-d, --database=name #View               

 

       the log file of the specified database

 

-h, --host=name      #View

 

       the log file on the specified host

 

--start-position =953 #Starting                 

 

            pos point   

 

--stop-position=1437 #End

 

            pos point         

 

--   

 

            start

 

-datetime= #Start

 

            time point

 

-- stop          -datetime=    #End time point        --database= #Specify            

 

            to restore only the database

Guess you like

Origin blog.csdn.net/zl17822307869/article/details/113915268