Показ дописів із міткою bash. Показати всі дописи
Показ дописів із міткою bash. Показати всі дописи

пʼятницю, 14 червня 2013 р.

MySQL - formatting output

Hey!
If you need to preserve fancy table output for your mysql queries, use the following switch: -t.
--table, -t
Display output in table format. This is the default for interactive use, but can be used to produce table output in batch mode.

Reference:
http://stackoverflow.com/questions/9745547/get-mysqls-fancy-table-format-as-stdout

четвер, 7 березня 2013 р.

MySQL in scripting - using timeouts

If you are using any cron jobs with which connect to MySQL and do some work it will be wise decision to think about what will happen when MySQL daemon stops. I'll tell you! Your scripts will not be able to connect to database. And they will run until database returns.  They may run forever!
Just look into man of mysqld.

      ·   connect_timeout
           The number of seconds before connection timeout. (Default value is
           0.)
See that?! Default value is 0 - it means infinity!
No need to have such risk.
Hence quickly add the following parameter to your scripts (example below use 5 seconds timeout):
--connect_timeout=5