Database Import error after exporting

aluknot picture aluknot · Feb 13, 2015 · Viewed 29.6k times · Source

Just like title say. I am using HeidiSQL, and i wan't to duplicate a database so i export the database, create a new empty with name "test". Then i change the name of the database to "test" in the .sql file and try to import the database, then i recieve this error

Error de SQL (1064): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right

syntax to use near '--

-- Host: ' at line 1

I think is something about the first part of the sql file, which is

-- --------------------------------------------------------
-- Host:                         
-- Versión del servidor:         5.5.41 - MySQL Community Server (GPL) by Remi
-- SO del servidor:              Linux
-- HeidiSQL Versión:             9.1.0.4867
-- --------------------------------------------------------

As far as i know its supposed to be only just comments.

Any suggestion?

Thanks in advance and sorry if its an idiot question but don't know how to solve this, i searched without results. Sorry if my english is not perfect too.

UPDATE: first 100 lines of the file

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8mb4 */;
/*!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' */;

-- Volcando estructura de base de datos para desarrolloweb
CREATE DATABASE IF NOT EXISTS `test` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `test`;


-- Volcando estructura para tabla desarrolloweb.tqg2h_akeeba_common
CREATE TABLE IF NOT EXISTS `tqg2h_akeeba_common` (
  `key` varchar(255) NOT NULL,
  `value` longtext NOT NULL,
  PRIMARY KEY (`key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- Volcando datos para la tabla desarrolloweb.tqg2h_akeeba_common: ~3 rows (aproximadamente)
/*!40000 ALTER TABLE `tqg2h_akeeba_common` DISABLE KEYS */;
INSERT INTO `tqg2h_akeeba_common` (`key`, `value`) VALUES
    ('stats_lastrun', '1419900936'),
    ('stats_siteid', '89afdf9407b43fb898c32abbabbdae6f4d9aefc8'),
    ('stats_siteurl', '94599098f96a3bbdb57077a7334fd064');
/*!40000 ALTER TABLE `tqg2h_akeeba_common` ENABLE KEYS */;


-- Volcando estructura para tabla desarrolloweb.tqg2h_ak_params
CREATE TABLE IF NOT EXISTS `tqg2h_ak_params` (
  `tag` varchar(255) NOT NULL,
  `data` longtext,
  PRIMARY KEY (`tag`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- Volcando datos para la tabla desarrolloweb.tqg2h_ak_params: ~1 rows (aproximadamente)
/*!40000 ALTER TABLE `tqg2h_ak_params` DISABLE KEYS */;
INSERT INTO `tqg2h_ak_params` (`tag`, `data`) VALUES
    ('update_version', '1.2.0');
/*!40000 ALTER TABLE `tqg2h_ak_params` ENABLE KEYS */;


-- Volcando estructura para tabla desarrolloweb.tqg2h_ak_profiles
CREATE TABLE IF NOT EXISTS `tqg2h_ak_profiles` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `description` varchar(255) NOT NULL,
  `configuration` longtext,
  `filters` longtext,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

-- Volcando datos para la tabla desarrolloweb.tqg2h_ak_profiles: ~1 rows (aproximadamente)
/*!40000 ALTER TABLE `tqg2h_ak_profiles` DISABLE KEYS */;
INSERT INTO `tqg2h_ak_profiles` (`id`, `description`, `configuration`, `filters`) VALUES
    (1, 'Default Backup Profile', '###AES128###+wNhUfQrnLFFGIxJfsqqq3NIRFdOAXfnDfQGV0GFrv0SEKKsrowqaqikqxO/Ej9ikG8kmDCKRq0Yt/vkM11aVkvLFYyDMXC/FilnxIkcT+BF/SNP0IGj0xT4FUmRZjUhhmBNl9cnWfIVxRioEGI/VJ4zk1TyhNIHc8tDhTwKus/ca5WB0nBe1u+N4hwMWMKOiovdCCSM7/BADHg6blaqhcBVL/J8mAE7pJApN/RmO6k3cMMuH5916XdOhJzQOL0ZmoaO3W+42VLTpZPp1vb83IJmXpsifoXSkwWQNF2Glm178VQR9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E KEYS */;


-- Volcando estructura para tabla desarrolloweb.tqg2h_ak_stats
CREATE TABLE IF NOT EXISTS `tqg2h_ak_stats` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `description` varchar(255) NOT NULL,
  `comment` longtext,
  `backupstart` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `backupend` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  `status` enum('run','fail','complete') NOT NULL DEFAULT 'run',
  `origin` varchar(30) NOT NULL DEFAULT 'backend',
  `type` varchar(30) NOT NULL DEFAULT 'full',
  `profile_id` bigint(20) NOT NULL DEFAULT '1',
  `archivename` longtext,
  `absolute_path` longtext,
  `multipart` int(11) NOT NULL DEFAULT '0',
  `tag` varchar(255) DEFAULT NULL,
  `backupid` varchar(255) DEFAULT NULL,
  `filesexist` tinyint(3) NOT NULL DEFAULT '1',
  `remote_filename` varchar(1000) DEFAULT NULL,
  `total_size` bigint(20) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `idx_fullstatus` (`filesexist`,`status`),
  KEY `idx_stale` (`status`,`origin`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- Volcando datos para la tabla desarrolloweb.tqg2h_ak_stats: ~0 rows (aproximadamente)
/*!40000 ALTER TABLE `tqg2h_ak_stats` DISABLE KEYS */;
/*!40000 ALTER TABLE `tqg2h_ak_stats` ENABLE KEYS */;


-- Volcando estructura para tabla desarrolloweb.tqg2h_ak_storage
CREATE TABLE IF NOT EXISTS `tqg2h_ak_storage` (
  `tag` varchar(255) NOT NULL,
  `lastupdate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `data` longtext,
  PRIMARY KEY (`tag`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- Volcando datos para la tabla desarrolloweb.tqg2h_ak_storage: ~0 rows (aproximadamente)
/*!40000 ALTER TABLE `tqg2h_ak_storage` DISABLE KEYS */;
/*!40000 ALTER TABLE `tqg2h_ak_storage` ENABLE KEYS */;

Answer

Ashwani Panwar picture Ashwani Panwar · May 1, 2015

In my case the solution was to change character set in sql file. Open your database .sql file and replace /*!40101 SET NAMES utf8mb4 */; to /*!40101 SET NAMES utf8 */; .