MySQL Tips

My SQL is one of the most popular and powerfull data bases. I have decided to do some blogs starting from some helpful hints on various helpful commands that we may need in day to day useage


We may need to source a sql script on mysql db hears the way


 mysql> source /home/shavantha/projects/product-folder/Builds/Release03/v1-0-b01/dbsetup/initial_data.sql


 mysql>source /home/shavantha/projects/product-folde/Builds/Release03/v1-0-b01/web/src/test/resources/sql/initial_test_data.sql;

If We need to grant permissions for a user on mysql
Permission
============
GRANT ALL PRIVILEGES ON <database>.* TO <username>@<machine ip> IDENTIFIED BY '<password>';


GRANT ALL PRIVILEGES ON script.* TO root@192.168.0.82 IDENTIFIED BY 'password';

How to take a MySQL DB Dump

1.To take a dump of a full DB
mysqldump -uroot -p mrecharge_db  >> dbback.sql
 

2.To take a dump of only a table
mysqldump -uroot -p mrecharge_db SYSTEM_CONFIGURATION >> table.sql

Comments