?
Solved

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

Posted on 2007-03-21
6
Medium Priority
?
1,961 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 17

Accepted Solution

by:
psimation earned 1500 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

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
Backups and Disaster RecoveryIn this post, we’ll look at strategies for backups and disaster recovery.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

752 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