1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Importing a MySql Database error...

Discussion in 'Server Configuration and Hosting' started by Rmarmorstein, Nov 16, 2013.

  1. Rmarmorstein

    Rmarmorstein Member

    I've been moving server hosts, so I downloaded a .sql file for the site's database from phpMyAdmin on the old site, and then now I'm tring to import it on the new site. However, I'm getting an error and I'm not sure what/if there is anything I can do to fix it.

    This is the error:

    Code:
    SQL query:
    
    --
    -- Database: `ghost`
    --
    -- --------------------------------------------------------
    --
    -- Table structure for table `EWRcarta_cache`
    --
    CREATE TABLE IF NOT EXISTS `EWRcarta_cache` (
    `page_id` int( 10 ) unsigned NOT NULL ,
    `cache_date` int( 10 ) unsigned NOT NULL ,
    `cache_content` mediumtext NOT NULL ,
    PRIMARY KEY ( `page_id` )
    ) ENGINE = InnoDB DEFAULT CHARSET = utf8;
    
    MySQL said: Documentation
    #1046 - No database selected 
    If you can give me any kind of suggestion, that would be great!
     
  2. WSWD

    WSWD Well-Known Member

    Have you actually created the database on the new server?
     
    MattW and borbole like this.
  3. borbole

    borbole Well-Known Member

    You see this line in the error message:

    Code:
    #1046 - No database selected 
    That means that you did not select a database to restore the backup file.
     
    MattW likes this.
  4. Rmarmorstein

    Rmarmorstein Member

    Thanks, that sure was dumb...

    But, I'm getting a new error, and it appears to be with the syntax.

    Code:
    Error
    
    SQL query:
    
    INSERT INTO `xf_template_compiled` (`style_id`, `language_id`, `title`, `template_compiled`) VALUES (6, 0, 'xenforo_alert.css', 0x245f5f6f7574707574203d2027273b0a245f5f6f7574707574202e3d20272e616c65727473202e616c65727447726f75700a7b0a096d617267696e2d626f74746f6d3a20323070783b0a7d0a0a2e616c65727473202e7072696d617279436f6e74656e740a7b0a096f766572666c6f773a2068696464656e3b207a6f6f6d3a20313b0a0970616464696e673a203570783b0a7d0a0a2e616c65727473202e6176617461720a7b0a09666c6f61743a206c6566743b0a7d0a0a2e616c65727473202e61766174617220696d670a7b0a0977696474683a20333270783b0a096865696768743a20333270783b0a7d0a0a2e616c65727473202e616c657274546578740a7b0a096d617267696e2d6c6566743a20333270783b0a0970616464696e673a2030203570783b0a7d0a0a2e616c657274732068330a7b0a09646973706c61793a20696e6c696e653b0a7d0a0a2e616c65727473206833202e7375626a6563740a7b0a09666f6e742d7765696768743a20626f6c643b0a7d0a0a2e616c65727473202e74696d65526f770a7b0a09666f6e742d73697a653a20313170783b0a096d617267696e2d746f703a203570783b0a7d0[...]
    
    MySQL said: Documentation
    #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 '' at line 9 
    thanks again for the help!
     
  5. SoeHoe

    SoeHoe Active Member

    same problem here. Please help!

    Code:
    Error
    
    SQL query:
    
    
    INSERT INTO `xf_template_compiled` (`style_id`, `language_id`, `title`, `template_compiled`) VALUES
    (1, 1, 0x504147455f434f4e5441494e4552, 0x245f5f6f7574707574203d2027273b0a245f5f6f7574707574202e3d20273c21444f43545950452068746d6c3e273b0a246973526573706f6e73697665203d20282858656e466f726f5f54656d706c6174655f48656c7065725f436f72653a3a7374796c6550726f70657274792827656e61626c65526573706f6e73697665272920414e442021246e6f526573706f6e7369766529203f202827312729203a202827302729293b0a245f5f6f7574707574202e3d20270a3c68746d6c2069643d2258656e466f726f22206c616e673d2227202e2068746d6c7370656369616c6368617273282476697369746f724c616e67756167655b276c616e67756167655f636f6465275d2c20454e545f51554f5445532c20275554462d382729202e202722206469723d2227202e2068746d6c7370656369616c6368617273282476697369746f724c616e67756167655b27746578745f646972656374696f6e275d2c20454e545f51554f5445532c20275554462d382729202e20272220636c6173733d225075626c6963204e6f4a732027202e2028282476697369746f725b27757365725f6964275d29203f2028274c[...]
    
    MySQL said: Documentation
    #2006 - MySQL server has gone away 
    Many thanks!
     
  6. Brogan

    Brogan XenForo Moderator Staff Member

    The most common cause of that is the server timed out and closed the connection.

    Try changing the wait_timeout value.
     
  7. SoeHoe

    SoeHoe Active Member

    Imported to live website no problem for me.

    The above issue only occurred when I import it to different database in my PC/localhost. I need it to test some modification. I have change the wait_timeout to 1000. Is it enough?
     
  8. Brogan

    Brogan XenForo Moderator Staff Member

    Did it work with a value of 1000?

    How are you importing to localhost?
    Presumably something like: mysql -uroot -proot database_name < backup.sql
     

Share This Page