Hi

Can someone guide me as i am getting this error message when attempting to import my local host DB into my remote Host.

I am using phpmyadmin to export/import and it maybe the way i am using the setting options? Just not sure?

Many thanks.

Error

There seems to be an error in your SQL query. The MySQL server error output below, if there is any, may also help you in diagnosing the problem

ERROR: Unknown Punctuation String @ 1
STR: <?
SQL: <?php
// $Id: database.mysql.inc,v 1.66.2.1 2007/01/22 02:20:50 unconed Exp $

/**
* @file
* Database interface code for MySQL database servers.
*/

/**
* @ingroup database
* @{
*/

/**
* Report database status.
*/
function db_status_report($phase) {
$t = get_t();

SQL query:

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 '<?php
// $Id: database.mysql.inc,v 1.66.2.1 2007/01/22 02:20:50 unconed Exp $
' at line 1

Comments

US421’s picture

It looks like you have PHP in your file. Did you export it as a SQL file? Try removing the first line and see how far you get. Is there a closing ?> you can see at the end of the first line?

MrStylist’s picture

Hi US421,

More info at

http://drupal.org/node/72477#comment-226755

I am using myphpadmin to export/import. I clicked all options for export, saved as a file and upload/import with myphpadmin in my host site. Got the error message and the tables did not create.

Not sure of php in the file. I can not read as the text is a continuous code with out line counts.

Thanks

vm’s picture

you are trying to import the file database.mysql.inc from drupal/includes. This is not how its done.

1) export your current DB using phpmyadmin this will give you a mysql file
2) import that mysql file using PHPmyadmin into the new DB.

US421’s picture

Ok,

I think by I clicked all options for export you mean that you selected all tables in the box in the top left corner. Basically just clicked Select All, am I right?

Next you say saved as a file was the file you saved it as a SQL file? Is the file named something like database.sql?

When you say the text is a continuous code do you mean something like

CREATE TABLE access (
  aid int(10) NOT NULL auto_increment,
  mask varchar(255) NOT NULL default '',
  type varchar(255) NOT NULL default '',
  status tinyint(2) NOT NULL default '0',
  PRIMARY KEY (aid)
)
DEFAULT CHARACTER SET utf8;

ore something else completely unreadable?(cause we can get you reading that) ;)

One last thing, what program are you using to try to read the file? You can use Notepad on Windows, or if you want line numbers, something nice like NoteTab Pro.

vm’s picture

his problem accrording to the link he posted is

* I have then tried to import the file database.mysql.inc from my drupal/includes to create the tables needed. This creates an Error page.

that file has php in it, which is causing his above output.

US421’s picture

Yes I see that now. We need to find that .sql file!

MrStylist’s picture

Hi,

Thanks to all,

I now have tried the correct myadminphp exported file (mydatabasename.sql) by importing into my remote host myadminphp. I am not getting the error message as previous but a confirmation;-

Import has been successfully finished, 0 queries executed.

My tables are still not loaded for some reason. I still must be doing something wrong? I should add when I execute the export i do have all tables checked.

US421’s picture

Hey we are getting somewhere! On the export page, in addition to having all the tables selected, do you have a check next to data and structure?

MrStylist’s picture

Hi,

Yes, I have the Data and Structure checked, including the sub check boxes.

US421’s picture

Ok, the beginning of the .sql file should look a whole lot like the code I posted above. The results you are getting are saying the file is blank. Can you open it up and take a look?

MrStylist’s picture

Hi,

I have opened the file in notepad.

It is full of code (small copy to show):-

-- phpMyAdmin SQL Dump
-- version 2.6.4-pl4
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: May 01, 2007 at 09:13 AM
-- Server version: 5.0.17
-- PHP Version: 5.1.1
--
-- Database: `alburyrspca

US421’s picture

Ok, probably I should have told you to try another export and see if you get the same thing when you import, but maybe you did that anyway. So...

What you have there is sort of a header that tells the details of your environment. The -- is a way to make a comment, that part is ignored by the database. After that it will say

CREATE TABLE access (

and that does just what you think, create the access table.
The details for the table come next, and then it will say

INSERT INTO access

and will give all the data you have stored into your access table. This is repeated with each table. Is that the format you see?

MrStylist’s picture

Hi,

I had to copy and paste into wordpad to be able to read in a type of paragraph format. In notepad it is all one line and not read friendly.

Yes it is in the format you mentioned.

US421’s picture

Ok, you might want to try that text editor I mentioned earlier. There is a free version but it does not have the page numbering I think. You will like it.

Anyway back to the exciting episode already in progress.

That file really should work. Did you give yourself DBA permissions when you created the database? Sure you imported the right file?

You can always try pasting the file directly into the query window in PHPMyAdmin. The location of the query window depends on your version of PHPMyAdmin. If you have a query tab it will be there, about halfway down. Otherwise try the import tab. It will be a text box with the caption SQL query on database your_database and the button will say submit query. Paste the file into the box, hit submit query, and see what you get.

MrStylist’s picture

Hi US421,

Thank you for your efforts, got your private email.

I found out that I have been attempting to upload the correct file via my network and for some reason the file was becoming corrupt. Maybe the fire wall was possibly encoding the upload/import and thus corrupting the file so it would not be read correctly by the hosts myphpadmin.??? Not that it matters now.

I worked around this by upload/import from the actual file on the computer that created it and YES it works and I now have my tables. Yippee.

The only thing is I now have a new error message;-

Fatal error: Call to undefined function: user_access() in /home/content/m/i/c/mydatabasename/html/modules/aggregator/aggregator.module on line 33

I will have a search in forums now, but if you know of this, many thanks in advance.