MySQL Backup and Restore Commands for Database Administration

Download Your Free eBooks NOW - 10 Free Linux eBooks for Administrators

Ravi Saive

Simple Word a Computer Geek and Linux Guru who loves to share tricks and tips on Internet. Most Of My Servers runs on Open Source Platform called Linux.

TecMint users Get a Free Domain and 30% off on Inmotion Web Hosting - Signup with Inmotion Now!

Download Free Linux eBooks

Advanced Bash-Scripting Guide
Linux Bible
A Newbie's Getting Started Guide to Linux
Ubuntu Linux Toolbox: 1000+ Commands

You may also like...

33 Responses

  1. shairalibaig says:

    how to take only incremental mysql database backup…

  2. Mamta says:

    Hi,

    I am using follwoing command, but it generates #1049 unknown database error.

    mysql -u [username] –p[password] [database_name] < [dump_file.sql]

    Do you have any idea why?

    Thanks in adavnce!!
    Mamta

    • Ravi Saive says:

      @Mamta,
      This means you’re trying to connect to a database that does not present in the MySQL. Please check your database name and try again.

  3. Shufil says:

    HI Ravi ,

    I backup all the DBes using this command mysqldump -u root -ptecmint –all-databases > all-databases.sql

    , How to sliptup this file now .

    Please advice .

    Shufil

  4. Ravi says:

    Hello I am new to mysql i Have to create the mysql user with proper privileges to restore the dump what privileges should i give for that user. Can you please help me.

  5. There´s yet a backup that include: tables, procedures, functions, etc… all of estructures:

    mysqldump -u user name_of_database –routines > backupFullStructures.sql

    I´ve used this

  6. Anupama says:

    hi,
    How to restore only data to existing database….
    i tried following…bt does’t worked…

    mysqlimport -u root -proot ml < c:\ml.sql

  7. sajid says:

    thanks ravi it’s very helpfull…

    can u pls tell me how to give the access to other host??

    • Ravi Saive says:

      From the mysql shell type the following command to give access to other or any remote machine.

      mysql> GRANT ALL PRIVILEGES ON databasename.* TO username@'remote-hoste' IDENTIFIED BY 'password';
      
  8. kavuta says:

    i wnt to restore database backed up from windows in fedora can i do this?

  9. jozo says:

    Do I must change folder in linux before mysqldump (maybe /var/..)

    # mysqldump -u username -p –all-databases > dump.sql
    And then restore them all using:

    # mysql -u username -p < dump.sql

  10. Dhruten says:

    how to restore whole database(including all the databases) in one go. because i took backup of all database in single .sql file ,now how to restore them via command line (linux)…

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Join Over 62000+ Linux Users
  1. 47558
  2. 2150
  3. 11343

Enter your email to get latest Linux Howto's