Skip to content

Instantly share code, notes, and snippets.

View rubiread's full-sized avatar

Ruwan Ranganath rubiread

View GitHub Profile
@rubiread
rubiread / Cloneuser.sh
Created September 13, 2016 13:36
clone linux user
#!/bin/bash
# clone a user
# usage:
# if you named this as below then
# change to the directory and run this command
# sudo bash clone-user.sh
echo "============="
echo "this script will create a new user"
| InnoDB | |
=====================================
2016-09-06 17:17:44 7f8702c17700 INNODB MONITOR OUTPUT
=====================================
Per second averages calculated from the last 59 seconds
-----------------
BACKGROUND THREAD
-----------------
srv_master_thread loops: 5358917 srv_active, 0 srv_shutdown, 1736765 srv_idle
srv_master_thread log flush and writes: 7095682
@rubiread
rubiread / mysqltunerdb1.sh
Created September 6, 2016 11:12
mysqltunerdb1
[--] Skipped version check for MySQLTuner script
Please enter your MySQL administrative login: root
Please enter your MySQL administrative password: [OK] Currently running supported MySQL version 5.6.31
[OK] Operating on 64-bit architecture
-------- Storage Engine Statistics -----------------------------------------------------------------
[--] Status: +ARCHIVE +BLACKHOLE +CSV -FEDERATED +InnoDB +MEMORY +MRG_MYISAM +MyISAM +PERFORMANCE_SCHEMA
[--] Data in InnoDB tables: 12G (Tables: 779)
[OK] Total fragmented tables: 0
@rubiread
rubiread / deletealldb.sql
Created September 2, 2016 08:38
Delete all databases from mysql
mysql -uroot -p -e "show databases" | grep -v Database | grep -v mysql| grep -v information_schema| grep -v test | grep -v OLD |gawk '{print "drop database " $1 ";select sleep(0.1);"}' | mysql -uroot -ppassword
@rubiread
rubiread / dbsizes.sql
Created September 2, 2016 04:51
Get mysql databases size
SELECT table_schema "DB Name",
Round(Sum(data_length + index_length) / 1024 / 1024, 1) "DB Size in MB"
FROM information_schema.tables
GROUP BY table_schema;