Monday 3 September 2018

Import the MySQL dump file does not return anything

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.

0 comments:

Post a Comment