I have successfully created a MYSQL dump on windows
mysqldump -u myuname -p mydb > path/to/mydbdump.sql
I uploaded the mydbdump.sql
to a live linux server, created a new database and trying to use these dumped data for new database
mysql -u myuname -p mynewdb < /path/to/mydbdump.sql
I get this error msg:
ERROR 1064: (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MYSQL server version for for right syntax near '??' at line 1
I don't know what I'm missing or doing wrong. Tried to restore this same file on a fresh database created on windows; didn't work.
UPDATE: First lines of dump file;
/*!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 */;
--
-- Table structure for table `ep_categories`
--
DROP TABLE IF EXISTS `ep_categories`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ep_categories` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
I have solved it using suggestions from @ÁlvaroG.Vicario.
Problem was that the sqldump was encoded in UTF-16 little endian
, so I re-encoded(using Notepad++ or linux iconv
command) into UTF-8 without BOM
and that solved it. I successfully restored sqldump into a new database server.