Saturday, June 30, 2012

Log slow queries for MySQL

Enabling slow queries log in MySQl (RedHat family):

[mysqld]
#log slow queires that takes more than 1 second
long_query_time=1
log-slow-queries=/var/lib/mysql/logs/mysql_slow_queries.log

Restart MySQL:
service mysqld restart

Sunday, June 24, 2012

Converting AWS Keypair to Putty Keys

get puttygen.exe and run it

Use COnversions->Import menu to imnport AWS keypair.
Next, use "Save private key" button to generate putty' key.
In putty go to SSH->Auth and select putty' (PPK) file location

Saturday, June 23, 2012

Determine filesystem on Linux

df -T [device]
NOTE: for partitioned FS we should look for [device1], [device2] etc - e.g. /dev/sdf1, /dev/sdf2 (/dev/sdf FS type could be unknown in this case)
http://www.cyberciti.biz/faq/linux-how-to-determine-find-out-file-system-type/

Repair ALL tables in a MySQL DB schema

Here is how to do it with the help of 'information_schema' of MySQL:

select concat('repair table ', table_name, ';') from information_schema.tables where table_schema='my-db-schema-name';

Thursday, June 07, 2012

Linux: Show all files modified in the last X days

> find -mtime -2 -print # where 2 is the number of days back