ERROR OCURRED

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Sunday, October 5, 2008

Mysql databses Backup & restore

Posted on 2:13 AM by Unknown
Database backup command.
You can use mysqldump command to take backup of your databases.
#mysqldump -h mysqlpc -u raman -p kumar testdata > testdata.sql
[-h] = host machine ..specify if u want.
[-u] = this is your database username
[-p] = this is the password for your database
[testdata] = the name of your database
[testdata.sql] = the file to which the backup should be written.

Multiple database backup.

If you want to specify the databases to backup, you can use the --databases parameter followed by the list of databases you would like to backup. Each database name has to be separated by at least one space when you type in the command. So if you have to backup 3 databases, let say Customers, Orders and Comments, you can issue the following command to back them up.
#mysqldump -u root -p pass21 --databases Customers Orders Comments > multibackup.sql

This is okay if you have a small set of databases you want to backup. Now how about backing up all the databases in the server? That's an easy one, just use the --all-databases parameter to backup all the databases in the server in one step.
#mysqldump --all-databases> alldatabases.sql

A Shell Script for Automating Backups?
You can automate the backup process by making a small shell script which will create a daily backup file. How do you get cron to back up your database without overwriting the older backup? You can use a tiny shell script to add the date to your backup file. An example of a shell script you could use is shown below.
#!/bin/sh
date=`date -I`
mysqldump --all-databases gzip > /var/backup/backup-$date.sql.gz

Restore your databases.
Make sure database name available on your machine.. To check use folowing command.
#mysql -u root -p (mysql password)
After login use following command to check databases name.
mysql>show databases;
If database name available that fine if not the create database ..use following command to create database
mysql > create database testdata;
After that quit from mysql....now use followig command to restore your database.
#mysql -u root -p **** testdata < /opt/backup/testdata.sql
Your database restore sucessfully...now u can check.

mysql> create database raman;
Query OK, 1 row affected (0.00 sec)

mysql> grant usage on raman.* to vendor@localhost identified by 'addbnm#83';
Query OK, 0 rows affected (0.00 sec)

mysql> grant all privileges on raman.* to vendor@localhost;
Query OK, 0 rows affected (0.00 sec)


[root@raman ~]# mysql -u vendor -p raman
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.0.77 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show tables;
Empty set (0.00 sec)
Read More
Posted in | No comments
Newer Posts Older Posts Home
Subscribe to: Posts (Atom)

Popular Posts

  • response to SOA query was unsuccessful: solved
    check your zone file [root@inf1sysadm1 data]# pwd /var/named/data # cat ind.raman.com.zone $ORIGIN . $TTL 3600 ; 1 hour ind.raman.com IN SO...
  • No package 'lua5.1' found
    hecking for LUA51... no checking for LUA51... configure: error: Package requirements (lua5.1 >= 5.1) were not met: No package 'lua5.1...
  • Adobe Photoshop CS5 Error 16 , Adobe Photoshop CS5 Error 7
    When you install Adobe Photoshop CS5 you might get some errors. In case you get one you will see a code and a little description. Is very im...
  • It is safe to clean windows prefetch folder and registry folder ?
     It is safe to clean windows prefetch folder and registry folder ? Will this boost Windows operating system capabilities ? Many of you hav...
  • How to find which scsi device you have.
    Find out how to specify their control address (/dev/sg2 or /dev/sg4 ) on the Changer Device = Bacula ( my example) 1) check the command lss...
  • X connection to localhost:10.0 broken (explicit kill or server shutdown).
    Solution:- With Xhost, you can solve this issue.
  • Steps how to change VolStatus in Bacula through bonsole.
    In my example MediaId=4 or Volumename=000018L4 shows volstatus is Purged. *list volumes Pool: Default +---------+------------+-----------+--...
  • /usr/bin/ssh-copy-id: ERROR: No identities found
    This error come while copy ssh id. [root@ramank .ssh]# ssh-copy-id 10.****.91.*** /usr/bin/ssh-copy-id: ERROR: No identities found Solution:...
  • Internet Explorer on Linux With installation Steps
    IEs4Linux   is the   simpler   way to have Microsoft Internet Explorer running on Linux (Linux   dedicated server   or any OS running   Wine...
  • Mysql databses Backup & restore
    Database backup command. You can use mysqldump command to take backup of your databases. #mysqldump -h mysqlpc -u raman -p kumar testdata ...

Categories

  • Adobe
  • Players
  • Reviews
  • Windows

Blog Archive

  • ►  2013 (27)
    • ►  October (3)
    • ►  August (1)
    • ►  June (1)
    • ►  April (3)
    • ►  February (10)
    • ►  January (9)
  • ►  2012 (29)
    • ►  December (2)
    • ►  November (7)
    • ►  October (10)
    • ►  September (4)
    • ►  August (1)
    • ►  June (2)
    • ►  April (1)
    • ►  March (1)
    • ►  January (1)
  • ►  2011 (36)
    • ►  December (3)
    • ►  November (3)
    • ►  October (1)
    • ►  September (5)
    • ►  August (4)
    • ►  May (2)
    • ►  April (4)
    • ►  March (5)
    • ►  February (2)
    • ►  January (7)
  • ►  2010 (24)
    • ►  December (1)
    • ►  November (1)
    • ►  October (4)
    • ►  August (1)
    • ►  May (1)
    • ►  April (1)
    • ►  March (2)
    • ►  February (5)
    • ►  January (8)
  • ►  2009 (18)
    • ►  December (6)
    • ►  November (3)
    • ►  August (1)
    • ►  July (2)
    • ►  June (1)
    • ►  May (1)
    • ►  April (1)
    • ►  March (1)
    • ►  February (1)
    • ►  January (1)
  • ▼  2008 (16)
    • ►  December (1)
    • ▼  October (1)
      • Mysql databses Backup & restore
    • ►  August (1)
    • ►  July (5)
    • ►  April (2)
    • ►  February (1)
    • ►  January (5)
  • ►  2007 (4)
    • ►  July (3)
    • ►  June (1)
Powered by Blogger.

About Me

Unknown
View my complete profile