-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmysql.yaml
More file actions
275 lines (268 loc) · 9.95 KB
/
mysql.yaml
File metadata and controls
275 lines (268 loc) · 9.95 KB
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
category: "数据库工具/MySQL工具"
description: "MySQL数据库管理与运维命令"
commands:
- name: "mysql"
description: "MySQL command-line client for database operations"
category: "Database"
platforms:
- "linux"
- "darwin"
- "windows"
usage:
- "mysql [options] [database]"
options:
- flag: "-u"
description: "Username for authentication"
- flag: "-p"
description: "Prompt for password"
- flag: "-h"
description: "Host to connect to"
- flag: "-P"
description: "Port number"
- flag: "-D"
description: "Database name"
- flag: "-e"
description: "Execute SQL statement and exit"
examples:
- command: "mysql -u root -p"
description: "Connect as root user with password prompt"
- command: "mysql -h localhost -u admin -p mydb"
description: "Connect to specific database on host"
- command: "mysql -u root -p -e 'SHOW DATABASES;'"
description: "Execute SQL command and exit"
- command: "mysql -h 192.168.1.100 -P 3306 -u user -p"
description: "Connect to remote MySQL server"
risks:
- level: "high"
description: "Direct database access; can modify or delete data"
- level: "medium"
description: "Avoid using passwords in command line (visible in process list)"
install_method: "Install MySQL Server or Client package"
version_check: "mysql --version"
- name: "mysqldump"
description: "MySQL database backup utility"
category: "Database"
platforms:
- "linux"
- "darwin"
- "windows"
usage:
- "mysqldump [options] [database] > backup.sql"
options:
- flag: "-u"
description: "Username for authentication"
- flag: "-p"
description: "Prompt for password"
- flag: "-h"
description: "Host to connect to"
- flag: "--all-databases"
description: "Dump all databases"
- flag: "--single-transaction"
description: "Use transaction for consistent backup (InnoDB)"
- flag: "--routines"
description: "Include stored procedures and functions"
- flag: "--triggers"
description: "Include triggers"
examples:
- command: "mysqldump -u root -p mydb > mydb_backup.sql"
description: "Backup single database"
- command: "mysqldump -u root -p --all-databases > all_backup.sql"
description: "Backup all databases"
- command: "mysqldump -u root -p --single-transaction --routines --triggers mydb > mydb_full.sql"
description: "Full backup with stored procedures and triggers"
- command: "mysqldump -u root -p mydb table1 table2 > tables_backup.sql"
description: "Backup specific tables"
risks:
- level: "medium"
description: "Large databases may take significant time and disk space"
- level: "low"
description: "Read-only operation but may impact performance on busy servers"
install_method: "Included with MySQL Server installation"
version_check: "mysqldump --version"
- name: "mysqlimport"
description: "Import data from text files into MySQL tables"
category: "Database"
platforms:
- "linux"
- "darwin"
- "windows"
usage:
- "mysqlimport [options] database file.txt"
options:
- flag: "-u"
description: "Username for authentication"
- flag: "-p"
description: "Prompt for password"
- flag: "--local"
description: "Read input files from client host"
- flag: "--replace"
description: "Replace existing rows with same unique key"
- flag: "--ignore"
description: "Ignore duplicate rows"
examples:
- command: "mysqlimport -u root -p mydb data.txt"
description: "Import data from text file"
- command: "mysqlimport -u root -p --local --replace mydb employees.txt"
description: "Import with replace mode from local file"
risks:
- level: "high"
description: "Can overwrite or modify existing data"
- level: "medium"
description: "Large imports may lock tables and affect performance"
install_method: "Included with MySQL Server installation"
version_check: "mysqlimport --version"
- name: "mysqladmin"
description: "MySQL server administration utility"
category: "Database"
platforms:
- "linux"
- "darwin"
- "windows"
usage:
- "mysqladmin [options] command [command-options]"
options:
- flag: "-u"
description: "Username for authentication"
- flag: "-p"
description: "Prompt for password"
- flag: "-h"
description: "Host to connect to"
examples:
- command: "mysqladmin -u root -p status"
description: "Display server status"
- command: "mysqladmin -u root -p processlist"
description: "Show active processes"
- command: "mysqladmin -u root -p create newdb"
description: "Create new database"
- command: "mysqladmin -u root -p drop olddb"
description: "Drop database"
- command: "mysqladmin -u root -p shutdown"
description: "Shutdown MySQL server"
risks:
- level: "critical"
description: "Can shutdown server or drop databases; use with extreme caution"
- level: "high"
description: "Administrative commands can affect all users and databases"
install_method: "Included with MySQL Server installation"
version_check: "mysqladmin --version"
- name: "mysqlcheck"
description: "Check, repair, analyze, and optimize MySQL tables"
category: "Database"
platforms:
- "linux"
- "darwin"
- "windows"
usage:
- "mysqlcheck [options] database [tables]"
options:
- flag: "-u"
description: "Username for authentication"
- flag: "-p"
description: "Prompt for password"
- flag: "--check"
description: "Check tables for errors"
- flag: "--repair"
description: "Repair corrupted tables"
- flag: "--analyze"
description: "Analyze tables for better query performance"
- flag: "--optimize"
description: "Optimize tables"
- flag: "--all-databases"
description: "Check all databases"
examples:
- command: "mysqlcheck -u root -p --check mydb"
description: "Check all tables in database"
- command: "mysqlcheck -u root -p --repair mydb mytable"
description: "Repair specific table"
- command: "mysqlcheck -u root -p --optimize --all-databases"
description: "Optimize all tables in all databases"
- command: "mysqlcheck -u root -p --analyze mydb"
description: "Analyze tables for query optimization"
risks:
- level: "medium"
description: "Repair operations may cause data loss if table is severely corrupted"
- level: "medium"
description: "Optimize locks tables; may impact performance during operation"
install_method: "Included with MySQL Server installation"
version_check: "mysqlcheck --version"
- name: "mysql_secure_installation"
description: "Script to improve MySQL installation security"
category: "Database"
platforms:
- "linux"
- "darwin"
- "windows"
usage:
- "mysql_secure_installation"
examples:
- command: "mysql_secure_installation"
description: "Run interactive security configuration wizard"
risks:
- level: "medium"
description: "Changes security settings; may lock out users if misconfigured"
install_method: "Included with MySQL Server installation"
version_check: "mysql --version"
- name: "mysqlshow"
description: "Display database, table, and column information"
category: "Database"
platforms:
- "linux"
- "darwin"
- "windows"
usage:
- "mysqlshow [options] [database [table [column]]]"
options:
- flag: "-u"
description: "Username for authentication"
- flag: "-p"
description: "Prompt for password"
- flag: "-h"
description: "Host to connect to"
- flag: "--status"
description: "Show table status information"
examples:
- command: "mysqlshow -u root -p"
description: "Show all databases"
- command: "mysqlshow -u root -p mydb"
description: "Show tables in database"
- command: "mysqlshow -u root -p mydb mytable"
description: "Show columns in table"
- command: "mysqlshow -u root -p --status mydb"
description: "Show table status with detailed information"
risks:
- level: "low"
description: "Read-only operation; no risks"
install_method: "Included with MySQL Server installation"
version_check: "mysqlshow --version"
- name: "mysqlbinlog"
description: "Process MySQL binary log files"
category: "Database"
platforms:
- "linux"
- "darwin"
- "windows"
usage:
- "mysqlbinlog [options] log_file"
options:
- flag: "--start-datetime"
description: "Start reading from specific datetime"
- flag: "--stop-datetime"
description: "Stop reading at specific datetime"
- flag: "--database"
description: "List only entries for specific database"
- flag: "--base64-output"
description: "Determine when binary log events should be displayed in base64"
examples:
- command: "mysqlbinlog binlog.000001"
description: "Display binary log contents"
- command: "mysqlbinlog --start-datetime='2024-01-01 00:00:00' binlog.000001"
description: "View logs from specific time"
- command: "mysqlbinlog --database=mydb binlog.000001 | mysql -u root -p"
description: "Replay binary log for specific database"
risks:
- level: "high"
description: "Replaying binary logs can modify database; use with caution"
- level: "medium"
description: "Binary logs may contain sensitive data"
install_method: "Included with MySQL Server installation"
version_check: "mysqlbinlog --version"