Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ERROR 1049 at line 21: Unknown database '`abc`'

Status
Not open for further replies.

11251995

Programmer
May 18, 2005
12
US
I did a DB dump from host1, and when I try to reload the dump file on host2, I got the above error - Unknown databse '`abc`'. I checked the dump file, and found out that there are (`) sign enclosed my databse name and all the table name. I am wondering if these ` char causes the problem?

How can I fix it? By removing my existed DB 'abc' (on my host2) or something else?

Thanks a lot,

jet


And here is the head of my dump file where I got: ERROR 1049 at line 21: Unknown database '`abc`'
================================

-- MySQL dump 10.9
--
-- Host: localhost Database:
-- ------------------------------------------------------
-- Server version 4.1.10a-standard

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0*/;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;

--
-- Current Database: `abc`
--

CREATE DATABASE /*!32312 IF NOT EXISTS*/ `abc` /*!40100 DEFAULT CHARACTER SET latin1 */;

USE `abc`;

--
-- Table structure for table `table1`
--

DROP TABLE IF EXISTS `table1`;
....
....

==================

 
I can't see why that wouldn't work, but it's certainly nothing to do with the grave-accent characters, or "backticks".

It's common practice (and universal in machine-generated code) to surround user-defined names (for databases, tables, columns, etc.) with backticks in order to distinguish them from SQL keywords. For example, "CREATE DATABASE `abc`;" is the same thing as "CREATE DATABASE abc;", except that the first form will work even if "abc" is a MySQL keyword.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top