MySQL : Show the size of databases and tables

Use the below command to dispalay the size of a particular table table_g from a particular database database_g

SELECT table_name AS "Table",
round(((data_length + index_length) / 1024 / 1024), 2) "Size in MB"
FROM information_schema.TABLES
WHERE table_schema = "database_g"
AND table_name = "table_g";

 

Use the below command to dispalay the size of every table from a particular database database_g

SELECT table_name AS "Tables",
round(((data_length + index_length) / 1024 / 1024), 2) "Size in MB"
FROM information_schema.TABLES
WHERE table_schema = "database_g";

 

Enjoy !!! ๐Ÿ™‚

ERROR 2003 (HY000): Can’t connect to MySQL server on ‘IP’ (111)

You might have noticed this error while connecting to a remote database server from other machines (different IP). See the below steps to resolve the issue.

1. Check the /etc/my.cnf configurations

2. Comment the bind IP line as belowย  :

# bind-address=127.0.0.1

which allows machines from other IPs to connect into this database server.

 

Enjoy ! ๐Ÿ™‚

Delete an entry from iptables

Use the Below 3 steps to remove an entry from the IPtables :

1. Check the Entry :
iptables-save | grep IP

2. Check the Line number :
iptables -nL -v –line-numbers | grep IP

3. Suppose the Line number is 100, Use the below command to delete the entry :
iptables -D PREROUTING 100

note : here I used the PREROUTING chain. Change it accordingly using the output from step 1.

Enjoy ๐Ÿ™‚