简体   繁体   中英

Import MySQL dump file returns nothing

i have a dump file that i am trying to import

mysql> use somedb_dec6; 
mysql> source somedump_nov29.sql

However when i do show tables; immediately it is showing me the correct tables, but if i get out of mysql prompt and login again and see what is in the database it shows me the following

mysql> show tables;
Empty set (0.00 sec)

Why is mysql not able to source the dump file? Thanks

as per request this is the dump file content

-- MySQL dump 10.11
--
-- Host: localhost    Database: some_test
-- ------------------------------------------------------
-- Server version       5.0.77

/*!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: `some_test`

Assuming you have access to terminal, can import like this:

mysql -u username -p database_name < file.sql

Note: It is better to use the full path of the SQL file file.sql .

original answer here || excellent guide here

source is seen more in execute an SQL script file.

The problem was, previously when i used enter mysql cli and source the dump after giving use thisdb it used to fill the thisdb with the dump. However ever since we updated the mysql version we had to open the dump file and change the use dumpfromsomeothersource to use thenewdb within the dumpfile.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM