Solved

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

Posted on 2007-03-21
6
1,921 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MySql Recovery 2 28
table joins in qry 17 65
simple html dom php accessing table/cell  values 4 23
Wordpress Query 5 27
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
This article discusses four methods for overlaying images in a container on a web page
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

830 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