Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am trying to import a mysqldump into a new database. When I run:

mysqldump -umydbuser -p --database testimport < database.dump

I get the following output:

Enter password:
-- MySQL dump 10.11
--
-- Host: localhost    Database: testimport
-- ------------------------------------------------------
-- Server version       5.0.75-0ubuntu10.3

/*!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 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!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' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Current Database: `testimport`
--

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

USE `testimport`;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2010-03-09 17:46:03

However, when I look at the testimport database, there are no tables and no data. Even if I export a working database by:

mysqldump -umydbuser -p --database workingdatabase > test.sql

and then import:

mysqldump -umydbuser -p --database testimport < test.sql

I get the same output, but nothing is imported into the testimport database. I don't see any errors in the output and it is using the proper database. If I tail the exported .sql file, I see the create statements for all tables and the inserts for all data. Why isn't this data importing? Is there any additional logging I can see?

share|improve this question

1 Answer 1

up vote 8 down vote accepted

You want to run the dump through the mysql client.

Example:

mysql -uroot -p testimport < database.dump

share|improve this answer
    
Thanks - but why is that? –  Josh M. Aug 18 at 1:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.