Read a CSV file into columns

May 6th, 2016

This command will read a CSV file, and display it as columns. This also works on Windows if you have Cygwin installed.

column -t -s"," test.csv

Example CSV columns

OpenVPN Linux DNS Issues Solved

October 20th, 2015

I can now resolve things on my Raspberry Pi (Raspbian) thanks to a helpful post here: http://www.softwarepassion.com/solving-dns-problems-with-openvpn-on-ubuntu-box/

MySQL Dump And Restore Database Table With Compression

August 30th, 2014

mysqldump --no-create-info -uxxxx -pxxxx Database ATable | gzip -9 > xxxx.sql.gz

zcat xxxx.sql.gz | mysql -uxxxx -pxxxx Database

Find MySQL Foreign Keys

January 9th, 2014

Sometimes you need a quick way to find out what foreign key is blocking your action.

SELECT
    CONCAT(table_name, '.', column_name) AS 'foreign key',
    CONCAT(referenced_table_name, '.', referenced_column_name) AS 'references'
FROM information_schema.key_column_usage
WHERE referenced_table_name IS NOT NULL;

http://www.conandalton.net/2008/09/list-foreign-key-constraints-in-oracle.html

MySQL Views and Explain

October 13th, 2013

This week, I ran into a problem when I was profiling that didn’t seem to be very well documented anywhere. I was trying to profile a query that included a view. The error message that I got when I tried to execute my EXPLAIN was: “EXPLAIN/SHOW can not be issued; lacking privileges for underlying table”

After a lot of flailing out, me and the DBA for this project figured out that in order to be able to execute my EXPLAIN, I needed to have SELECT on the key columns that I was using in my query for the table behind the view. Simple enough, but not something made easy to figure out.

Hopefully this helps someone else figure this out faster.

Happy hunting!

WordPress - Entries (RSS) and Comments (RSS) - © 2011 Ben Dauphinee