13b5d864034a5bf97193e0b3c95a2632476158e8
Tech/MySQL.md
... | ... | @@ -4,37 +4,50 @@ title: MySQL |
4 | 4 | |
5 | 5 | # Basics |
6 | 6 | |
7 | - show databases; |
|
8 | - show tables; |
|
9 | - use somedb; |
|
10 | - |
|
7 | +```sql |
|
8 | +show databases; |
|
9 | +show tables; |
|
10 | +use somedb; |
|
11 | +``` |
|
11 | 12 | |
12 | -Variables: |
|
13 | +Variables: |
|
13 | 14 | |
14 | - show variables like "%foo%"; |
|
15 | - |
|
15 | +```sql |
|
16 | +show variables like "%foo%"; |
|
17 | +``` |
|
16 | 18 | |
17 | -Status: |
|
19 | +Status: |
|
18 | 20 | |
19 | - show status like "%foo%"; |
|
20 | - |
|
21 | +```sql |
|
22 | +show status like "%foo%"; |
|
23 | +``` |
|
21 | 24 | |
25 | +# Logging |
|
22 | 26 | |
27 | +mysql: |
|
23 | 28 | |
24 | -# Blocked Hosts |
|
29 | +```sql |
|
30 | +set GLOBAL general_log_file = '/var/log/mysql/general.log'; |
|
31 | +set GLOBAL general_log = 'ON'; |
|
32 | +``` |
|
25 | 33 | |
26 | - mysqladmin flush-hosts |
|
27 | - |
|
34 | +# Blocked Hosts |
|
28 | 35 | |
36 | +```shell |
|
37 | +mysqladmin flush-hosts |
|
38 | +``` |
|
29 | 39 | |
30 | 40 | |
31 | 41 | # Permissions |
32 | 42 | |
33 | -Current: |
|
43 | +Current: |
|
34 | 44 | |
35 | - show grants; |
|
36 | - |
|
45 | +```sql |
|
46 | +show grants; |
|
47 | +``` |
|
37 | 48 | |
38 | -Available: |
|
49 | +Available: |
|
39 | 50 | |
40 | - show privileges; |
|
... | ... | \ No newline at end of file |
0 | +```sql |
|
1 | +show privileges; |
|
2 | +``` |