importing sql db

Events happening in the community are now at Drupal community events on www.drupal.org.
rotnme's picture

Trying to import my db from a backup file. Getting the error message:

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 'utf8' at line 1 ;

These are the first 30 lines of my db file

-- version 2.11.9.4

-- http://www.phpmyadmin.net

-- Host: 173.201.217.5
-- Generation Time: Dec 14, 2010 at 06:37 PM
-- Server version: 5.0.91
-- PHP Version: 5.2.8

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

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

--

--
utf8;


--

-- Table structure for table access

DROP TABLE IF EXISTS access;

any help is appreciated.........

Comments

How did you make the backup?

JBstrikesagain's picture

How did you make the backup? I assume you are using phpmyadmin to import it now? Did you go from Unix to windows back to unix and mess up the format of the file (unix and windows use different methods to indicate new lines)

the problem seems to be with

utf8;

what's up with that? the format you pasted got all messed up by the input filter in drupal.. repost the first 30 lines within HTML pre tags and set the input format to "Filtered HTML -- No Markdown"

here is what one of my databases looks like

root@trianglebeats backups]# head -n 30 john_wp-2010-11-06.sql
-- MySQL dump 10.11
--
-- Host: localhost    Database: john_wp
-- ------------------------------------------------------
-- Server version	5.0.45

/*!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 `wp_comments`
--

DROP TABLE IF EXISTS `wp_comments`;
CREATE TABLE `wp_comments` (
  `comment_ID` bigint(20) unsigned NOT NULL auto_increment,
  `comment_post_ID` bigint(20) unsigned NOT NULL default '0',
  `comment_author` tinytext NOT NULL,
  `comment_author_email` varchar(100) NOT NULL default '',
  `comment_author_url` varchar(200) NOT NULL default '',
  `comment_author_IP` varchar(100) NOT NULL default '',
  `comment_date` datetime NOT NULL default '0000-00-00 00:00:00',
[root@trianglebeats backups]# head -n 30 john_wp-2010-11-06.sql  | grep -i utf8
/*!40101 SET NAMES utf8 */;

If you have shell access you can do the following to create a backup and then import it

shell> mysqldump db_name > backup-file.sql

shell> mysql db_name < backup-file.sql

more info on mysqldump:

http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html

exported with phpadmin and

rotnme's picture

exported with phpadmin and then imported same. All done on a mac.

30 lines

exported with phpadmin then

rotnme's picture

exported with phpadmin then imported same. All done on a mac.
30 lines

-- phpMyAdmin SQL Dump
-- version 2.11.9.4
-- http://www.phpmyadmin.net
--
-- Host: 173.201.217.5
-- Generation Time: Dec 14, 2010 at 06:37 PM
-- Server version: 5.0.91
-- PHP Version: 5.2.8

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";


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

--
--
--
 utf8;


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

--
-- Table structure for table `access`
--

DROP TABLE IF EXISTS `access`;

I really don't know SQL well,

JBstrikesagain's picture

I really don't know SQL well, but if you copy the exported DB to a new temporary file remove the line that just has
utf8;

And then try the import, does it work?

I did exactly that and

rotnme's picture

I did exactly that and uploaded and my database has been restored, thank you. However, the problem that has now arisen..... When I try to access my site and configure using http//dcubedbuilders.com/drupal/ this is the error message I am getting

Fatal error: Call to undefined function node_load() in /home/content/m/a/r/markcissi/html/drupal/includes/menu.inc on line 410

I did go into settings.php and change the db that was there because it was not referencing the correct db.
How can I resolve this error if I can't access the site as an admin? One problem solved and another rears its head. Any help appreciated as always.

okay so you just removed the

JBstrikesagain's picture

okay so you just removed the line with

utf8;

and the db imported fine but now you're getting the undefined function error..

Are you sure the username and permissions set in settings.php are correct?

Are you migrating from one server to another? Are you sure you have all of the drupal installation migrated?

usernames/permissioins are

rotnme's picture

usernames/permissioins are good. Not going from one server to another. drupal install is all accounted for.

so what are you backing up

JBstrikesagain's picture

so what are you backing up from and restoring to exactly? ie if you aren't going from one server to another server, what changed?

I have no idea, hence the

rotnme's picture

I have no idea, hence the mystery. Backed up from godaddy, restored to the same. I am going crazy trying to figure out this error,

Fatal error: Call to undefined function node_load() in /home/content/m/a/r/markcissi/html/drupal/includes/menu.inc on line 410

but you backed up

JBstrikesagain's picture

but you backed up some_db_name to a file.. then imported it back over the original db? is that what you're saying?

I backed up my db, tried to

rotnme's picture

I backed up my db, tried to import it back after losing stuff. It did not overwrite anything. Did a re-install of drupal 6.19, the whole shebang.

this is line 410 from

rotnme's picture

this is line 410 from menu.inc

 $return = $function($value);

Are you dropping all the

dpickerel's picture

Are you dropping all the tables (I drop and create the whole database) before restoring?
node_load is just a normal function out of /modules/node/node.module. It could mean the system table is messed up and the node module isn't enabled, or a cached version of the list of active modules isn't being loaded right, or the code is missing.

It looks like the settings

dpickerel's picture

It looks like the settings should be in comment fields, but you're oddly matched.

In this you can see their are balanced comment open and close declaration.
btw, i don't use phpmyadmin at all for backups and recovery, there are too many problems.
I use
mysqldump

and "source filename" from the command line. Much more reliable.
-Don-

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

-Don-

Take a look at the Backup and

fxarte's picture

Take a look at the Backup and Migrate module.
This module will allow you to backup your database from the Drupal administration section.
This is a standard module in all my projects

Good luck!

triDUG

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: