By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,853 Members | 1,570 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,853 IT Pros & Developers. It's quick & easy.

Restoring Numeric Databases

P: n/a
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

Sep 2 '05 #1
Share this Question
Share on Google+
4 Replies


P: 4
my guess is that you should post to the mysql forum as its not related to php.

mysqldump --help

but in mysql 5.0.9 it includes the ``, it could be me though

Paul
Sep 2 '05 #2

P: n/a
Raffi wrote:
CREATE DATABASE /*!32312 IF NOT EXISTS*/ 123456789;
How can I use mysqldump and restore to work properly with numeric
databases?


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.
Sep 2 '05 #3

P: n/a
*** Raffi wrote/escribió (1 Sep 2005 19:46:54 -0700):
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `123456789`;

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


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
--
Sep 2 '05 #4

P: n/a
Alvaro G Vicario wrote:
*** Raffi wrote/escribió (1 Sep 2005 19:46:54 -0700):
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `123456789`;

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


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
--


Á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

Sep 2 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.