Skip to content

Commit c86f55b

Browse files
committed
These are what I learned in 2019-03-12.
1 parent 0e1c16e commit c86f55b

File tree

2 files changed

+85
-71
lines changed

2 files changed

+85
-71
lines changed

README.md

Lines changed: 72 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ This repo has a tool that help you to manage and write down what you learned in
1313
| Table of Contents | :point_down: |
1414
| -------- | -------- |
1515
| :new: **Top 5 recent learning** | |
16+
| [Export MySQL data by specified query to CSV file](mysql/Export-MySQL-data-by-specified-query-to-CSV-file.md) [mysql] | 2019-03-12 |
1617
| [Run shell command in all hosts](ansible/Run-shell-command-in-all-hosts.md) [ansible] | 2019-02-18 |
1718
| [Can not run downloaded binary inside alpine linux because of missing shared libs](docker/Can-not-run-downloaded-binary-inside-alpine-linux-because-of-missing-shared-libs.md) [docker] | 2019-02-02 |
1819
| [Critical notice of string DOM manipulation using jQuery](javascript/Critical-notice-of-string-DOM-manipulation-using-jQuery.md) [javascript] | 2019-01-10 |
1920
| [SSH to docker host in Docker for Mac](docker/SSH-to-docker-host-in-Docker-for-Mac.md) [docker] | 2018-12-03 |
20-
| [View function source in developer tool console](javascript/View-function-source-in-developer-tool-console.md) [javascript] | 2018-11-21 |
2121
| :books: **ansible** [ 1 articles ] | |
2222
| 1. [Run shell command in all hosts](ansible/Run-shell-command-in-all-hosts.md) | 2019-02-18 |
2323
| :books: **bash** [ 4 articles ] | |
@@ -84,95 +84,96 @@ This repo has a tool that help you to manage and write down what you learned in
8484
| 49. [Make cron job runs every seconds](linux/Make-cron-job-runs-every-seconds.md) | 2018-11-15 |
8585
| :books: **mac-osx** [ 1 articles ] | |
8686
| 50. [Shortcut keyboard improve productivity](mac-osx/Shortcut-keyboard-improve-productivity.md) | 2015-11-30 |
87-
| :books: **mysql** [ 7 articles ] | |
87+
| :books: **mysql** [ 8 articles ] | |
8888
| 51. [Index is useless when use function on indexed field](mysql/Index-is-useless-when-use-function-on-indexed-field.md) | 2015-12-01 |
8989
| 52. [String problems can cause logical bugs in application](mysql/string-problems-can-cause-logical-bugs-in-application.md) | 2017-02-17 |
9090
| 53. [UNION vs UNION ALL](mysql/union-vs-union-all.md) | 2017-02-23 |
9191
| 54. [Mysql dumping only table structure](mysql/Mysql-dumping-only-table-structure.md) | 2017-05-17 |
9292
| 55. [Mycli : a new good cli MySql Client](mysql/mycli-:-a-new-good-cli-mysql-client.md) | 2017-09-01 |
9393
| 56. [Sleeping connections in MySQL](mysql/Sleeping-connections-in-MySQL.md) | 2018-01-04 |
9494
| 57. [The safest way to reset root password of MySQL Server](mysql/safest-way-to-reset-root-password-of-mysql-server.md) | 2018-08-25 |
95+
| 58. [Export MySQL data by specified query to CSV file](mysql/Export-MySQL-data-by-specified-query-to-CSV-file.md) | 2019-03-12 |
9596
| :books: **nature** [ 1 articles ] | |
96-
| 58. [Tại sao biển xanh lại mặn ? :lol:](nature/tai-sao-bien-xanh-lai-man.md) | 2018-01-14 |
97+
| 59. [Tại sao biển xanh lại mặn ? :lol:](nature/tai-sao-bien-xanh-lai-man.md) | 2018-01-14 |
9798
| :books: **networking** [ 5 articles ] | |
98-
| 59. [TCP FIN timeout](networking/tcp-fin-timeout.md) | 2017-09-07 |
99-
| 60. [How SMTP works](networking/How-SMTP-works.md) | 2017-10-04 |
100-
| 61. [Set up simple rate limiting on specified port using UFW](networking/Set-up-simple-rate-limiting-on-specified-port-using-UFW.md) | 2018-01-16 |
101-
| 62. [List opening ports or listening UNIX sockets](networking/List-opening-ports-or-listening-UNIX-sockets.md) | 2018-02-21 |
102-
| 63. [Setup wildcard domains .test for development in MacOS](networking/Setup-wildcard-domains-.local-for-development-in-MacOS.md) | 2018-04-24 |
99+
| 60. [TCP FIN timeout](networking/tcp-fin-timeout.md) | 2017-09-07 |
100+
| 61. [How SMTP works](networking/How-SMTP-works.md) | 2017-10-04 |
101+
| 62. [Set up simple rate limiting on specified port using UFW](networking/Set-up-simple-rate-limiting-on-specified-port-using-UFW.md) | 2018-01-16 |
102+
| 63. [List opening ports or listening UNIX sockets](networking/List-opening-ports-or-listening-UNIX-sockets.md) | 2018-02-21 |
103+
| 64. [Setup wildcard domains .test for development in MacOS](networking/Setup-wildcard-domains-.local-for-development-in-MacOS.md) | 2018-04-24 |
103104
| :books: **php** [ 8 articles ] | |
104-
| 64. [Eloquent Many-to-Many Relationship](php/Eloquent-Many-to-Many-Relationship.md) | 2015-12-02 |
105-
| 65. [Run built-in server via Docker](php/Run-built-in-server-via-Docker.md) | 2015-12-04 |
106-
| 66. [F-cking stupid limit of input vars](php/Fcking-stupid-limit-of-input-vars.md) | 2016-03-08 |
107-
| 67. [Using VarDumper in PHPUnit](php/using-vardumper-in-phpunit.md) | 2017-02-23 |
108-
| 68. [Persistent connection to MySQL](php/Persistent-connection-to-MySQL.md) | 2017-02-28 |
109-
| 69. [realpath function](php/realpath-function.md) | 2017-08-06 |
110-
| 70. [try, catch and finally in PHP](php/try,-catch-and-finally-in-PHP.md) | 2018-05-04 |
111-
| 71. [Never autostart XDebug in cli environment](php/Never-autostart-XDebug-in-cli-environment.md) | 2018-05-07 |
105+
| 65. [Eloquent Many-to-Many Relationship](php/Eloquent-Many-to-Many-Relationship.md) | 2015-12-02 |
106+
| 66. [Run built-in server via Docker](php/Run-built-in-server-via-Docker.md) | 2015-12-04 |
107+
| 67. [F-cking stupid limit of input vars](php/Fcking-stupid-limit-of-input-vars.md) | 2016-03-08 |
108+
| 68. [Using VarDumper in PHPUnit](php/using-vardumper-in-phpunit.md) | 2017-02-23 |
109+
| 69. [Persistent connection to MySQL](php/Persistent-connection-to-MySQL.md) | 2017-02-28 |
110+
| 70. [realpath function](php/realpath-function.md) | 2017-08-06 |
111+
| 71. [try, catch and finally in PHP](php/try,-catch-and-finally-in-PHP.md) | 2018-05-04 |
112+
| 72. [Never autostart XDebug in cli environment](php/Never-autostart-XDebug-in-cli-environment.md) | 2018-05-07 |
112113
| :books: **programming** [ 1 articles ] | |
113-
| 72. [Get random number from computer](programming/Get-random-number-from-computer.md) | 2018-05-14 |
114+
| 73. [Get random number from computer](programming/Get-random-number-from-computer.md) | 2018-05-14 |
114115
| :books: **python** [ 7 articles ] | |
115-
| 73. [String Format Unicode params](python/String-Format-Unicode-params.md) | 2015-12-01 |
116-
| 74. [Reference assign object variable](python/Reference-assign-object-variable.md) | 2015-12-04 |
117-
| 75. [HTTP2 supported for python requests library](python/HTTP2-supported-for-python-requests-library.md) | 2017-08-04 |
118-
| 76. [Exporting environment variables on virtual env activate](python/Exporting-environment-variables-on-virtual-env-activate.md) | 2018-04-30 |
119-
| 77. [Do not use mutable objects as default parameters](python/Do-not-use-mutable-objects-as-default-parameters.md) | 2018-07-24 |
120-
| 78. [Context Managers in Python](python/Context-Managers.md) | 2018-07-24 |
121-
| 79. [Setter and getter behavior of class property in Python3](python/Setter-and-getter-behavior-of-class-property-in-Python3.md) | 2018-07-30 |
116+
| 74. [String Format Unicode params](python/String-Format-Unicode-params.md) | 2015-12-01 |
117+
| 75. [Reference assign object variable](python/Reference-assign-object-variable.md) | 2015-12-04 |
118+
| 76. [HTTP2 supported for python requests library](python/HTTP2-supported-for-python-requests-library.md) | 2017-08-04 |
119+
| 77. [Exporting environment variables on virtual env activate](python/Exporting-environment-variables-on-virtual-env-activate.md) | 2018-04-30 |
120+
| 78. [Do not use mutable objects as default parameters](python/Do-not-use-mutable-objects-as-default-parameters.md) | 2018-07-24 |
121+
| 79. [Context Managers in Python](python/Context-Managers.md) | 2018-07-24 |
122+
| 80. [Setter and getter behavior of class property in Python3](python/Setter-and-getter-behavior-of-class-property-in-Python3.md) | 2018-07-30 |
122123
| :books: **quote** [ 1 articles ] | |
123-
| 80. [Random quote 23 Feb 2017](quote/random-quote-23-feb-2017.md) | 2017-02-23 |
124+
| 81. [Random quote 23 Feb 2017](quote/random-quote-23-feb-2017.md) | 2017-02-23 |
124125
| :books: **redis** [ 1 articles ] | |
125-
| 81. [Transaction style in Redis](redis/Transaction-style-in-Redis.md) | 2018-01-31 |
126+
| 82. [Transaction style in Redis](redis/Transaction-style-in-Redis.md) | 2018-01-31 |
126127
| :books: **sysadmin** [ 34 articles ] | |
127-
| 82. [FTP via curl tool](sysadmin/FTP-via-curl-tool.md) | 2015-12-03 |
128-
| 83. [View real-time logs using websocketd](sysadmin/View-real-time-logs-using-websocketd.md) | 2015-12-04 |
129-
| 84. [Commands](sysadmin/Commands.md) | 2015-12-30 |
130-
| 85. [Stats your top-10 frequently commands](sysadmin/Stats-your-top-10-commands.md) | 2016-03-26 |
131-
| 86. [Bash shell shortcuts](sysadmin/Bash-shell-shortcuts.md) | 2016-03-26 |
132-
| 87. [Compressing and Extracting files with rar in Linux](sysadmin/Compressing-and-Extracting-files-with-rar-in-Linux.md) | 2017-05-17 |
133-
| 88. [Grant user to use sudo without password](sysadmin/Grant-user-to-use-sudo-without-password.md) | 2017-05-18 |
134-
| 89. [wget Output flag](sysadmin/wget-Output-flag.md) | 2017-05-19 |
135-
| 90. [Using BSD find util to find and exec command on file and folder](sysadmin/Using-BSD-find-util-to-find-and-exec-command-on-file-and-folder.md) | 2017-05-22 |
136-
| 91. [zcat : decompressing pipe tool](sysadmin/zcat-:-decompressing-pipe-tool.md) | 2017-05-22 |
137-
| 92. [Gearman bash worker and client](sysadmin/gearman-bash-worker-and-client.md) | 2017-06-15 |
138-
| 93. [Cleaning up old linux kernels](sysadmin/Cleaning-up-old-linux-kernels.md) | 2017-08-06 |
139-
| 94. [Create SSH tunnel manually](sysadmin/create-ssh-tunnel-manually.md) | 2017-09-01 |
140-
| 95. [Enable reverse proxy in CentOS](sysadmin/enable-reverse-proxy-in-centos.md) | 2017-09-01 |
141-
| 96. [Ansible playbook : skip to task](sysadmin/ansible-:-skip-to-task.md) | 2017-09-05 |
142-
| 97. [Grep : find a string in folder](sysadmin/grep-:-find-a-string-in-folder.md) | 2017-09-05 |
143-
| 98. [Lock and unlock a user password](sysadmin/lock-and-unlock-a-user-password.md) | 2017-09-07 |
144-
| 99. [Generate dhparam file faster](sysadmin/generate-dhparam-file-faster.md) | 2017-09-07 |
145-
| 100. [Blocking specified country to prevent from DDOS](sysadmin/blocking-specified-country-to-prevent-from-ddos.md) | 2017-09-25 |
146-
| 101. [BASH exiting on first error](sysadmin/bash-exiting-on-first-error.md) | 2017-09-26 |
147-
| 102. [BASH return a value in function](sysadmin/bash-return-a-value-in-function.md) | 2017-09-26 |
148-
| 103. [BASH tracing commands](sysadmin/BASH-tracing-commands.md) | 2017-09-27 |
149-
| 104. [TIME command output meaning](sysadmin/time-command-output-meaning.md) | 2017-10-04 |
150-
| 105. [Using netcat as tiny TCP debug tool](sysadmin/using-netcat-as-tiny-tcp-debug-tool.md) | 2017-10-07 |
151-
| 106. [Getting your external IP](sysadmin/Getting-your-external-IP.md) | 2017-11-24 |
152-
| 107. [Use journalctl to check system logs](sysadmin/Use-journalctl-to-check-system-logs.md) | 2018-01-22 |
153-
| 108. [Prevent source hacking from .git directory exposing](sysadmin/prevent-source-hacking-from-.git-directory-exposing.md) | 2018-03-01 |
154-
| 109. [Create a sequence of numbers](sysadmin/Create-a-sequence-of-numbers.md) | 2018-03-25 |
155-
| 110. [Prepend line number to file](sysadmin/Prepend-line-number-to-file.md) | 2018-03-25 |
156-
| 111. [Cut file content from line to line](sysadmin/Cut-file-content-from-line-to-line.md) | 2018-03-25 |
157-
| 112. [Send a file through networking via netcat](sysadmin/Send-a-file-through-networking-via-netcat.md) | 2018-04-10 |
158-
| 113. [Create tiny chat channel via netcat](sysadmin/Create-tiny-chat-channel-via-netcat.md) | 2018-04-10 |
159-
| 114. [View DNS history of a domain](sysadmin/View-DNS-history-of-a-domain.md) | 2018-05-08 |
160-
| 115. [Curl override Name Resolution with specific IP address](sysadmin/Curl-override-Name-Resolution-with-specific-IP-address.md) | 2018-08-18 |
128+
| 83. [FTP via curl tool](sysadmin/FTP-via-curl-tool.md) | 2015-12-03 |
129+
| 84. [View real-time logs using websocketd](sysadmin/View-real-time-logs-using-websocketd.md) | 2015-12-04 |
130+
| 85. [Commands](sysadmin/Commands.md) | 2015-12-30 |
131+
| 86. [Stats your top-10 frequently commands](sysadmin/Stats-your-top-10-commands.md) | 2016-03-26 |
132+
| 87. [Bash shell shortcuts](sysadmin/Bash-shell-shortcuts.md) | 2016-03-26 |
133+
| 88. [Compressing and Extracting files with rar in Linux](sysadmin/Compressing-and-Extracting-files-with-rar-in-Linux.md) | 2017-05-17 |
134+
| 89. [Grant user to use sudo without password](sysadmin/Grant-user-to-use-sudo-without-password.md) | 2017-05-18 |
135+
| 90. [wget Output flag](sysadmin/wget-Output-flag.md) | 2017-05-19 |
136+
| 91. [Using BSD find util to find and exec command on file and folder](sysadmin/Using-BSD-find-util-to-find-and-exec-command-on-file-and-folder.md) | 2017-05-22 |
137+
| 92. [zcat : decompressing pipe tool](sysadmin/zcat-:-decompressing-pipe-tool.md) | 2017-05-22 |
138+
| 93. [Gearman bash worker and client](sysadmin/gearman-bash-worker-and-client.md) | 2017-06-15 |
139+
| 94. [Cleaning up old linux kernels](sysadmin/Cleaning-up-old-linux-kernels.md) | 2017-08-06 |
140+
| 95. [Create SSH tunnel manually](sysadmin/create-ssh-tunnel-manually.md) | 2017-09-01 |
141+
| 96. [Enable reverse proxy in CentOS](sysadmin/enable-reverse-proxy-in-centos.md) | 2017-09-01 |
142+
| 97. [Ansible playbook : skip to task](sysadmin/ansible-:-skip-to-task.md) | 2017-09-05 |
143+
| 98. [Grep : find a string in folder](sysadmin/grep-:-find-a-string-in-folder.md) | 2017-09-05 |
144+
| 99. [Lock and unlock a user password](sysadmin/lock-and-unlock-a-user-password.md) | 2017-09-07 |
145+
| 100. [Generate dhparam file faster](sysadmin/generate-dhparam-file-faster.md) | 2017-09-07 |
146+
| 101. [Blocking specified country to prevent from DDOS](sysadmin/blocking-specified-country-to-prevent-from-ddos.md) | 2017-09-25 |
147+
| 102. [BASH exiting on first error](sysadmin/bash-exiting-on-first-error.md) | 2017-09-26 |
148+
| 103. [BASH return a value in function](sysadmin/bash-return-a-value-in-function.md) | 2017-09-26 |
149+
| 104. [BASH tracing commands](sysadmin/BASH-tracing-commands.md) | 2017-09-27 |
150+
| 105. [TIME command output meaning](sysadmin/time-command-output-meaning.md) | 2017-10-04 |
151+
| 106. [Using netcat as tiny TCP debug tool](sysadmin/using-netcat-as-tiny-tcp-debug-tool.md) | 2017-10-07 |
152+
| 107. [Getting your external IP](sysadmin/Getting-your-external-IP.md) | 2017-11-24 |
153+
| 108. [Use journalctl to check system logs](sysadmin/Use-journalctl-to-check-system-logs.md) | 2018-01-22 |
154+
| 109. [Prevent source hacking from .git directory exposing](sysadmin/prevent-source-hacking-from-.git-directory-exposing.md) | 2018-03-01 |
155+
| 110. [Create a sequence of numbers](sysadmin/Create-a-sequence-of-numbers.md) | 2018-03-25 |
156+
| 111. [Prepend line number to file](sysadmin/Prepend-line-number-to-file.md) | 2018-03-25 |
157+
| 112. [Cut file content from line to line](sysadmin/Cut-file-content-from-line-to-line.md) | 2018-03-25 |
158+
| 113. [Send a file through networking via netcat](sysadmin/Send-a-file-through-networking-via-netcat.md) | 2018-04-10 |
159+
| 114. [Create tiny chat channel via netcat](sysadmin/Create-tiny-chat-channel-via-netcat.md) | 2018-04-10 |
160+
| 115. [View DNS history of a domain](sysadmin/View-DNS-history-of-a-domain.md) | 2018-05-08 |
161+
| 116. [Curl override Name Resolution with specific IP address](sysadmin/Curl-override-Name-Resolution-with-specific-IP-address.md) | 2018-08-18 |
161162
| :books: **tools** [ 2 articles ] | |
162-
| 116. [Base 64 encode and decode builtin tool](tools/base-64-encode-and-decode-builtin-tool.md) | 2017-04-21 |
163-
| 117. [Zip compressing list of files](tools/zip-compressing-list-of-files.md) | 2017-09-25 |
163+
| 117. [Base 64 encode and decode builtin tool](tools/base-64-encode-and-decode-builtin-tool.md) | 2017-04-21 |
164+
| 118. [Zip compressing list of files](tools/zip-compressing-list-of-files.md) | 2017-09-25 |
164165
| :books: **varnish** [ 1 articles ] | |
165-
| 118. [Check vcl file syntax before restarting](varnish/Check-vcl-file-syntax-before-restarting.md) | 2018-01-31 |
166+
| 119. [Check vcl file syntax before restarting](varnish/Check-vcl-file-syntax-before-restarting.md) | 2018-01-31 |
166167
| :books: **vim** [ 2 articles ] | |
167-
| 119. [Using mark to bookmark checkpoints in files](vim/Using-mark-to-bookmark-checkpoints-in-files.md) | 2018-01-30 |
168-
| 120. [Convert tabs to spaces](vim/Convert-tabs-to-spaces.md) | 2018-02-21 |
168+
| 120. [Using mark to bookmark checkpoints in files](vim/Using-mark-to-bookmark-checkpoints-in-files.md) | 2018-01-30 |
169+
| 121. [Convert tabs to spaces](vim/Convert-tabs-to-spaces.md) | 2018-02-21 |
169170
| :books: **web** [ 6 articles ] | |
170-
| 121. [Cloudflare Error 522 Connection Time out](web/Cloudflare-Error-522-Connection-Time-out.md) | 2017-05-18 |
171-
| 122. [Ping Google to crawl updated content](web/ping-google-to-crawl-updated-content.md) | 2017-08-08 |
172-
| 123. [Using web proxy to bypass firewalls](web/Using-web-proxy-to-bypass-firewalls.md) | 2017-12-07 |
173-
| 124. [HSTS rule in browser](web/HSTS-rule-in-browser.md) | 2018-01-03 |
174-
| 125. [Bypass CORS by using JSONP callback](web/Bypass-CORS-by-using-JSONP-callback.md) | 2018-01-08 |
175-
| 126. [Sending Cookie in AJAX CORs request](web/sending-cookie-in-ajax-cors-request.md) | 2018-03-01 |
171+
| 122. [Cloudflare Error 522 Connection Time out](web/Cloudflare-Error-522-Connection-Time-out.md) | 2017-05-18 |
172+
| 123. [Ping Google to crawl updated content](web/ping-google-to-crawl-updated-content.md) | 2017-08-08 |
173+
| 124. [Using web proxy to bypass firewalls](web/Using-web-proxy-to-bypass-firewalls.md) | 2017-12-07 |
174+
| 125. [HSTS rule in browser](web/HSTS-rule-in-browser.md) | 2018-01-03 |
175+
| 126. [Bypass CORS by using JSONP callback](web/Bypass-CORS-by-using-JSONP-callback.md) | 2018-01-08 |
176+
| 127. [Sending Cookie in AJAX CORs request](web/sending-cookie-in-ajax-cors-request.md) | 2018-03-01 |
176177

177178

178179
# Instruction
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
- Date : 2019-03-12
2+
- Tags : #mysql #cli
3+
4+
## Export MySQL data by specified query to CSV file
5+
6+
To export data from MySQL by specified query to CSV file, you can use this command
7+
8+
```bash
9+
$ mysql -B -u username -p database_name -h dbhost -e "SELECT * FROM table_name;" | sed "s/'/\'/;s/\t/\",\"/g;s/^/\"/;s/$/\"/;s/\n//g"
10+
```
11+
12+
Tip from : https://stackoverflow.com/a/25427665
13+

0 commit comments

Comments
 (0)