In today session Chandrasheker sir started to teach mysql.
Today I learnt many thing in mysql .
already i have blogged about mysql queries and how to take backup using mysql queries
as mysql-for-beginners.
But today sir told about how to take backup without using queries
From shell ,
sathia@sathia-laptop:~$ mysqladmin -uroot -p(password) create sales_datails
we can create database using this command
First you should know where mysql datadir will be stored
mysql> SHOW VARIABLES LIKE ‘datadir’;
+—————+———————+
| Variable_name | Value |
+—————+———————-+
| datadir | /var/lib/mysql/ |
+—————+———————-+
1 row in set (0.00 sec)
or through shell :
sathia@sathia-laptop:~$ mysql -e “SHOW VARIABLES LIKE ‘datadir'” -uroot -p
We can connect mysql database of remote host by
mysql -h 10.xx.xx.xx(IP) -uroot -p
Databases will be stored in /var/lib/mysql
sathia@sathia-laptop:/var/lib$ sudo ls mysql/
debian-5.1.flag ib_logfile1 salesdetails suresh
ibdata1 mysql sathia
ib_logfile0 mysql_upgrade_info sathia-laptop.pid
We can create tar file of database , using tar command .
Then we can give untar file when we need into same directory by following command
sathia@sathia-laptop:~$ sudo tar xzvf salesdetails.tar.gz -C /var/lib/mysql/