MYSQLDUMP, Create new database, before restoring SQL Data.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Frank

    #1

    MYSQLDUMP, Create new database, before restoring SQL Data.

    I can use mysqldump to create a .sql file backup of my data..

    For importing how can I test to see if the DB exists, if it does
    import the .sql

    If not create the DB then import the .sql !

    Thanks
  • Parallax

    #2
    Re: MYSQLDUMP, Create new database, before restoring SQL Data.

    <Frank @ MyPlace.Com (Frank)> wrote in message
    news:3f20f102.1 54973890@news.b tclick.com...[color=blue]
    > I can use mysqldump to create a .sql file backup of my data..
    >
    > For importing how can I test to see if the DB exists, if it does
    > import the .sql
    >
    > If not create the DB then import the .sql !
    >
    > Thanks[/color]

    Dump the database with --opt --no-create-db

    mysqldump --opt --no-create-db database [tables]


    The manual SQL syntax would be something like

    USE dbname IF EXISTS dbname;

    Although I think the above commands accomplish what you want.

    Regards,
    Parallax


    Comment

    Working...