Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2016-01-08 00:22:13

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,909
Website

[resolved] db.sql header editing help

I have a site setup and functioning on a new host’s server. I slapped it together using install files and a db dump from my local “dev” machine.

The process for handling the DB was:

  1. Use command-line to export dump file.
  2. Create database on host using their dashboard UI
  3. Import dump file using command-line
  4. Edit config.php file for new db name, user, pword, and path

All good.

Now I’m trying to update the database with a more recent dump file exported from a different (production) server. But there’s something about the header of the new dump file that MySQL doesn’t like. Here’s the error I get at command-line:

ERROR 1044 (42000) at line 8: Access denied for user ‘XXX’@‘localhost’ to database ‘OOO

I was puzzled by that because the database name is actually “OOO_main”, so I looked in the .sql file and at line 8 and 9 there’s this:

CREATE DATABASE `OOO` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `OOO`;

Presumably it’s trying create a differently named database on import, and failing because one is already locked in. Then I tried editing those lines to just this, thinking the create database part might safely be removed:

/*!40100 DEFAULT CHARACTER SET utf8 */;

That ended up creating a different error:

ERROR 1064 (42000) at line 8: 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 ‘DEFAULT CHARACTER SET utf8 */’ at line 1

Here’s the entire header (down to the first db table) of the latest .sql file I need to import, but which I can’t get to work:

-- Adminer 4.2.0 MySQL dump

SET NAMES utf8;
SET time_zone = '+00:00';
SET foreign_key_checks = 0;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';

CREATE DATABASE `OOO` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `OOO`;

For comparison, here’s the header (down to the first db table) of the earlier .sql file from my local server that did import without problems:

-- MySQL dump 10.13  Distrib 5.6.23, for osx10.10 (x86_64)
--
-- Host: localhost    Database: me_OOO_main
-- ------------------------------------------------------
-- Server version    5.6.23

/*!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 */;

If I try to use phpMyAdmin, the same headaches occur.

Anyone know how I might edit the header of the production dump file to make it work?

Last edited by Destry (2016-01-08 01:22:22)

Offline

#2 2016-01-08 01:21:48

Destry
Member
From: Haut-Rhin
Registered: 2004-08-04
Posts: 4,909
Website

Re: [resolved] db.sql header editing help

Problem solved by simply removing the offending lines 8 and 9 and leaving everything else in tact.

Upload complete.

Offline

Board footer

Powered by FluxBB