WordPress.org

Ready to get started?Download WordPress

Forums

MySQL/Database error when moving WordPress hosts. (7 posts)

  1. theblackbird070@gmail.com
    Member
    Posted 1 year ago #

    Hello everyone,

    I have backed up all my wordpress files and databases of my wordpress blog so I can import these to my new host. Everything is going fine and have edited all the code to make the blog work on the new urls etc. I have created a different database with different details than my old one in phpMyAdmin and am trying to import .sql file to my new database. Although, when I upload it mid-way through I get this error:

    SQL query:

    -- phpMyAdmin SQL Dump
    -- version 2.8.0.1
    -- http://www.phpmyadmin.net
    --
    -- Host: custsql-ipg06.eigbox.net
    -- Generation Time: Oct 09, 2012 at 06:44 AM
    -- Server version: 5.0.91
    -- PHP Version: 4.4.9
    --
    -- Database: wrd_4dhogad2nn
    --
    -- --------------------------------------------------------
    --
    -- Table structure for table wp_commentmeta
    --
    DROP TABLE IF EXISTS wp_commentmeta ;

    MySQL said:

    #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 '

    DROP TABLE IF EXISTS wp_commentmeta' at line 1

    I have no idea what the problem is, and to be honest: I have editted something at the top since I was having a different error. To make life easier I will post the top bit of the original unedited .sql file that I backed up and also the new one I editted.

    Orignal back-up (unedited):

    -- phpMyAdmin SQL Dump
    -- version 2.8.0.1
    -- http://www.phpmyadmin.net
    --
    -- Host: custsql-ipg06.eigbox.net
    -- Generation Time: Oct 09, 2012 at 06:44 AM
    -- Server version: 5.0.91
    -- PHP Version: 4.4.9
    --
    -- Database: <code>wrd_lh1dkh37gb</code>
    --
    CREATE DATABASE <code>wrd_lh1dkh37gb</code> DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
    USE <code>wrd_lh1dkh37gb</code>;
    
    -- --------------------------------------------------------
    
    --
    -- Table structure for table <code>wp_commentmeta</code>
    -- 
    
    DROP TABLE IF EXISTS <code>wp_commentmeta</code>;
    CREATE TABLE IF NOT EXISTS <code>wp_commentmeta</code> (
      <code>meta_id</code> bigint(20) unsigned NOT NULL auto_increment,
      <code>comment_id</code> bigint(20) unsigned NOT NULL default '0',
      <code>meta_key</code> varchar(255) default NULL,
      <code>meta_value</code> longtext,
      PRIMARY KEY  (<code>meta_id</code>),
      KEY <code>comment_id</code> (<code>comment_id</code>),
      KEY <code>meta_key</code> (<code>meta_key</code>)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
    
    --
    -- Dumping data for table <code>wp_commentmeta</code>
    -- 
    
    -- --------------------------------------------------------
    
    --

    And here is the edited version:

    -- phpMyAdmin SQL Dump
    -- version 2.8.0.1
    -- http://www.phpmyadmin.net
    --
    -- Host: custsql-ipg06.eigbox.net
    -- Generation Time: Oct 09, 2012 at 06:44 AM
    -- Server version: 5.0.91
    -- PHP Version: 4.4.9
    --
    -- Database: <code>wrd_4dhogad2nn</code>
    -- 
    
    -- --------------------------------------------------------
    
    --
    -- Table structure for table <code>wp_commentmeta</code>
    -- 
    
    DROP TABLE IF EXISTS <code>wp_commentmeta</code>;
    CREATE TABLE IF NOT EXISTS <code>wp_commentmeta</code> (
      <code>meta_id</code> bigint(20) unsigned NOT NULL auto_increment,
      <code>comment_id</code> bigint(20) unsigned NOT NULL default '0',
      <code>meta_key</code> varchar(255) default NULL,
      <code>meta_value</code> longtext,
      PRIMARY KEY  (<code>meta_id</code>),
      KEY <code>comment_id</code> (<code>comment_id</code>),
      KEY <code>meta_key</code> (<code>meta_key</code>)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
    
    --
    -- Dumping data for table <code>wp_commentmeta</code>
    -- 
    
    -- --------------------------------------------------------
    
    --

    The reason for me editing the file was because an error popped-up saying that I cannot create a new database, as you can see in the first few lines the .sql commands to make a new database with the following details. Although the host only allows databases to be created through their panel. So I editted this tiny bit out so it would only import the tables.

    THE PROBLEM IS: To be honest, this was the first time of me editing .sql files therefore I am unsure whether I have done it the right way or not. And I am most certain that this may have caused the problem.

    So is there anyone expert out here that can help me out please! I would be hugely thankful! Thanks for your time.

    Regards,

    Shad

  2. s_ha_dum
    Member
    Posted 1 year ago #

    Your export is not valid SQL. The <code> and </code> tags should not be there. Those should be backticks. Did this forum's parser convert those or do those show up in your file?

    What software did you use to edit the file? Errors like that are the kinds of things you get when edit code with a word processor.

  3. theblackbird070@gmail.com
    Member
    Posted 1 year ago #

    Oh no, sorry

    In the original file they are indeed backticks, although someone in the process of pasting it has transferred to ` , don't really know why?</p>
    <p>Anyway here is the code again, this unedited version : </p>
    <code><p>-- phpMyAdmin SQL Dump<br />
    -- version 2.8.0.1<br />
    -- http://www.phpmyadmin.net<br />
    --<br />
    -- Host: custsql-ipg06.eigbox.net<br />
    -- Generation Time: Oct 09, 2012 at 06:41 AM<br />
    -- Server version: 5.0.91<br />
    -- PHP Version: 4.4.9<br />
    --<br />
    -- Database: <code>wrd_lh1dkh37gb`
    --
    CREATE DATABASE wrd_lh1dkh37gb DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
    USE wrd_lh1dkh37gb;

    -- --------------------------------------------------------

    --
    -- Table structure for table wp_commentmeta
    --

    DROP TABLE IF EXISTS wp_commentmeta;
    CREATE TABLE IF NOT EXISTS wp_commentmeta (
    meta_id bigint(20) unsigned NOT NULL auto_increment,
    comment_id bigint(20) unsigned NOT NULL default '0',
    meta_key varchar(255) default NULL,
    meta_value longtext,
    PRIMARY KEY (meta_id),
    KEY comment_id (comment_id),
    KEY meta_key (meta_key)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

    --
    -- Dumping data for table wp_commentmeta
    --

    -- --------------------------------------------------------

    --

    And here the one that I've edited it to:

    <br />
    -- phpMyAdmin SQL Dump<br />
    -- version 2.8.0.1<br />
    -- http://www.phpmyadmin.net<br />
    --<br />
    -- Host: custsql-ipg06.eigbox.net<br />
    -- Generation Time: Oct 09, 2012 at 06:44 AM<br />
    -- Server version: 5.0.91<br />
    -- PHP Version: 4.4.9<br />
    --<br />
    -- Database: <code></code>wrd_4dhogad2nn

    --

    -- --------------------------------------------------------

    --
    -- Table structure for table wp_commentmeta
    --

    DROP TABLE IF EXISTS wp_commentmeta;
    CREATE TABLE IF NOT EXISTS wp_commentmeta (
    meta_id bigint(20) unsigned NOT NULL auto_increment,
    comment_id bigint(20) unsigned NOT NULL default '0',
    meta_key varchar(255) default NULL,
    meta_value longtext,
    PRIMARY KEY (meta_id),
    KEY comment_id (comment_id),
    KEY meta_key (meta_key)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;

    --
    -- Dumping data for table wp_commentmeta
    --

    -- --------------------------------------------------------

    --

    Thanks Again!

  4. theblackbird070@gmail.com
    Member
    Posted 1 year ago #

    Hmm, sorry it even turned out worse.

    How about I just give you the links to the whole files:

    Here is the old one: https://www.dropbox.com/s/ojecl7rsyucdz83/custsql-ipg06.eigbox.net-BACKUP-OLD.sql

    Here is the one that I've edited: https://www.dropbox.com/s/ib4k2aunjpce9ho/custsql-ipg06.eigbox.net.sql

    Sorry for that!

  5. theblackbird070@gmail.com
    Member
    Posted 1 year ago #


  6. s_ha_dum
    Member
    Posted 1 year ago #

    Ok. What software did you use to edit the SQL file? If you used a word processor that could be the problem.

    Also, there is a hash of your password in those dumps. If is a weak password or one subject to a dictionary attack, it could be brute forced. Please change that when your site goes back up.

  7. halty
    Member
    Posted 1 year ago #

    You can try this : http://www.halty.net/wordpress-mover.php

    It will move your blog and database automatically. No need to play with phpmyadmin.

Topic Closed

This topic has been closed to new replies.

About this Topic