Restoring Numeric Databases

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

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

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

Thanks for your help.

Re: Restoring Numeric Databases

Raffi wrote:
Quoted text here. Click to load it

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:

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

Bill K.

Re: Restoring Numeric Databases

*** Raffi wrote/escribió (1 Sep 2005 19:46:54 -0700):
Quoted text here. Click to load it

          Quote table and column names with `

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

Re: Restoring Numeric Databases

Alvaro G Vicario wrote:
Quoted text here. Click to load it


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.


Site Timeline