Tuesday, February 3, 2015

Query to find size of MySQL DB

When we are using shared hosting server with Windows or Linux, without any control panel software, It's little bit hard to find user's disk usage on mysql.

In this case we can use  following command on mysql to get size of database.

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;

Shell script for read line from text file

My need: Read line from the text file by shell script and append few text before and after the line. Script: #!/bin/bash file="...