Solved

MySQL - phpMyAdmin - syntax error 1064 when trying to import database

Posted on 2007-03-21
6
1,906 Views
Last Modified: 2013-12-13
Using phpMyAdmin I have exported a database from one server (php version 5.0.4) and want to import it onto a new server (php version 5.0.37) but when I import it I get an error message as follows:


Error
SQL query:

-- phpMyAdmin SQL Dump
-- version 2.6.0-pl3
-- http://www.phpmyadmin.net
--
-- Host: mysql4db.gradwell.net
-- Generation Time: Mar 21, 2007 at 12:51 PM
-- Server version: 4.1.10
-- PHP Version: 5.0.4
--
-- Database: `smallbone`
--
-- --------------------------------------------------------
--
-- Table structure for table `admin_user`
--
CREATE TABLE  `admin_user` (
 `user_name` tinytext NOT NULL ,
 `user_pass` tinytext NOT NULL ,
 `user_id` smallint( 6 ) NOT NULL AUTO_INCREMENT ,
 `type` tinyint( 4 ) NOT NULL default  '0',
KEY  `user_id` (  `user_id` )
) TYPE = MYISAM DEFAULT CHARACTER SET = latin1 AUTO_INCREMENT =3;


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 'user_name` tinytext NOT NULL,
  `user_pass` tinytext NOT NULL,
  `user_id` small' at line 1




I don't know enough PHP/SQL to solve this! Help!
Thank you.
0
Comment
Question by:bbourgeaux
6 Comments
 
LVL 14

Expert Comment

by:Aamir Saeed
ID: 18765366
try

CREATE TABLE  `admin_user` (
 `user_name` tinytext NOT NULL ,
 `user_pass` tinytext NOT NULL ,
 `user_id` smallint( 6 ) NOT NULL AUTO_INCREMENT ,
 `type` tinyint( 4 ) NOT NULL default  '0',
KEY  `user_id` (  `user_id` )
)
0
 

Author Comment

by:bbourgeaux
ID: 18765469
Thanks for your quick answer but it didn't work. I get the exact same error message.
0
 
LVL 28

Expert Comment

by:gamebits
ID: 18768890
What version of mysql are you using?

In the meantime you can try this

replace `user_id` smallint( 6 ) NOT NULL AUTO_INCREMENT ,

by `user_id` 'smallint'( 6 ) NOT NULL AUTO_INCREMENT ,

0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 17

Accepted Solution

by:
psimation earned 500 total points
ID: 18769720
The problem is almost 100% with the difference in MySQL versions than with php versions.

Try to re-export the db from the server using different options like "Complete Inserts" "Extended Inserts" and "Enclose table and field names with backquotes ". The last time I ran into a similar problem, I just tried different combinations of those options and I eventually got it to work. Better still, just make sure you have the same version of phpmyadmin installed on both servers and the same major number of mysql ( ie. mysql4.x or mysql5.x on both servers)
0
 
LVL 17

Expert Comment

by:psimation
ID: 18769726
Sorry, meant to say PHPMyAdmin AND MySQL versions, ie. PHP version itself should not cause any problems, but the version of phpmyadmin and mysql will play a role; try to get the versions of both to be the same on both servers for maximum compatability.
0
 

Author Comment

by:bbourgeaux
ID: 18778978
I re-exported the database on a different computer this time and it worked! The settings were the same though... strange.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Not needed 13 58
Editing login page in zencart. 2 16
Phone Dialer 5 38
How to add a Chat functions to my PHP site ? 3 20
'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now