Restoring Numeric Databases

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

    #1

    Restoring Numeric Databases

    Hi,

    I'm developing a database application that uses numeric databases. At
    this point not using numeric databases is not an option. Doing a
    mysqldump works. However when trying to restore the database with
    "mysql -u root -psecret < backup.sql" gives the following error
    message:

    ERROR 1064 at line 11: You have an error in your SQL syntax near
    '123456789' at line 1

    Line 1 has the following line:

    CREATE DATABASE /*!32312 IF NOT EXISTS*/ 123456789;

    I know this will generate an error. The correct syntax would be:

    CREATE DATABASE /*!32312 IF NOT EXISTS*/ `123456789`;

    How can I use mysqldump and restore to work properly with numeric
    databases?

    Thanks for your help.
    Raffi

  • Bill Karwin

    #2
    Re: Restoring Numeric Databases

    Raffi wrote:[color=blue]
    > CREATE DATABASE /*!32312 IF NOT EXISTS*/ 123456789;
    > How can I use mysqldump and restore to work properly with numeric
    > databases?[/color]

    Here's what I would try:

    Edit the dump file to remove (or comment) the CREATE DATABASE statement.
    There's also a "--no-create-db" flag for mysqldump to suppress the
    CREATE DATABASE statement. See the docs:
    http://dev.mysql.com/doc/mysql/en/mysqldump.html

    Then create the database manually with a shell command like:
    mysqladmin create 123456789

    Then restore the database from the dump file, naming the database as an
    argument on the command line:
    mysql -D 123456789 < dumpfile.sql

    Regards,
    Bill K.

    Comment

    • Alvaro G Vicario

      #3
      Re: Restoring Numeric Databases

      *** Raffi wrote/escribió (1 Sep 2005 19:46:54 -0700):[color=blue]
      > CREATE DATABASE /*!32312 IF NOT EXISTS*/ `123456789`;
      >
      > How can I use mysqldump and restore to work properly with numeric
      > databases?[/color]



      -Q|--quote-names
      Quote table and column names with `

      --
      -- Álvaro G. Vicario - Burgos, Spain
      -- http://bits.demogracia.com - Mi sitio sobre programación web
      -- Don't e-mail me your questions, post them to the group
      --

      Comment

      • Raffi

        #4
        Re: Restoring Numeric Databases

        Alvaro G Vicario wrote:[color=blue]
        > *** Raffi wrote/escribió (1 Sep 2005 19:46:54 -0700):[color=green]
        > > CREATE DATABASE /*!32312 IF NOT EXISTS*/ `123456789`;
        > >
        > > How can I use mysqldump and restore to work properly with numeric
        > > databases?[/color]
        >
        > http://www.hmug.org/man/1/mysqldump.php
        >
        > -Q|--quote-names
        > Quote table and column names with `
        >
        > --
        > -- Álvaro G. Vicario - Burgos, Spain
        > -- http://bits.demogracia.com - Mi sitio sobre programación web
        > -- Don't e-mail me your questions, post them to the group
        > --[/color]

        Álvaro,

        Thanks. This is what I needed. I had looked through the man pages
        briefly yesterday but may have missed this option. I'll try a
        dump/restore later today and see if all works as it should.

        Raffi

        Comment

        Working...