This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
table_name, | |
round(((data_length + index_length) / 1024 / 1024), 2) size_mb | |
FROM information_schema.TABLES | |
WHERE table_schema = (SELECT database()) | |
ORDER BY size_mb DESC; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# taken from http://severalnines.com/blog/field-live-migration-mmm-mariadb-galera-cluster | |
SELECT DISTINCT | |
CONCAT(t.table_schema,'.',t.table_name) as tbl, | |
t.engine, | |
IF(ISNULL(c.constraint_name),'NOPK','') AS nopk, | |
IF(s.index_type = 'FULLTEXT','FULLTEXT','') as ftidx, | |
IF(s.index_type = 'SPATIAL','SPATIAL','') as gisidx | |
FROM information_schema.tables AS t | |
LEFT JOIN information_schema.key_column_usage AS c | |
ON (t.table_schema = c.constraint_schema AND t.table_name = c.table_name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl ipecho.net/plain; echo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
python -m SimpleHTTPServer 8000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* run \. /tmp/mysql_victims.txt after executing this query */ | |
SELECT | |
concat('KILL ', id, ';') | |
FROM | |
information_schema.processlist | |
WHERE | |
user='victim' AND time > 60 | |
INTO OUTFILE '/tmp/mysql_victims.txt'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
socat "UNIX-LISTEN:your_local_path/mysql.sock,reuseaddr,fork" \ | |
EXEC:'ssh user@remote-host socat STDIO UNIX-CONNECT\:/your_server_path/mysql.sock" | |
mysql -S your_local_path/mysql.sock -u user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
table_schema "Data Base Name", | |
sum( data_length + index_length ) / 1024 / | |
1024 "Data Base Size in MB", | |
sum( data_free )/ 1024 / 1024 "Free Space in MB" | |
FROM | |
information_schema.TABLES | |
GROUP BY table_schema ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# a handy one-liner to print out sql queries if you wouldn't like to enable | |
# queries logging in mysql server itself | |
tcpdump -i lo -s 0 -l -w - dst port 3306 | strings | perl -e ' | |
while(<>) { chomp; next if /^[^ ]+[ ]*$/; | |
if(/^(SELECT|UPDATE|DELETE|INSERT|SET|COMMIT|ROLLBACK|CREATE|DROP|ALTER)/i) { | |
if (defined $q) { print "$q\n\n"; } | |
$q=$_; | |
} else { | |
$_ =~ s/^[ \t]+//; $q.=" $_"; | |
} |
NewerOlder