SQL dumps

Discussion in 'Server Operation' started by woody, May 3, 2005.

  1. woody

    woody New Member

    I know I can do this by using phpMyAdmin, but I wonder if/how I can create sql dumps of my MySQL databases on the commandline?
     
  2. sphere

    sphere New Member

  3. ingo

    ingo New Member

    If you don't have a database password (very insecure!), use this:

    Code:
    mysqldump -h <db_server, e.g. localhost> -u <db_user, e.g. root> -c --add-drop-table --add-locks --all --quick --lock-tables <db_name> > /path/to/your/sql_dump.sql
    If you have a database password:

    Code:
    mysqldump -h <db_server, e.g. localhost> -u <db_user, e.g. root> -p<db_password, no space after -p!> -c --add-drop-table --add-locks --all --quick --lock-tables <db_name> > /path/to/your/sql_dump.sql
    Ingo
     

Share This Page