LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 08-02-2012, 09:00 AM   #1
dreamcoder
LQ Newbie
 
Registered: Jul 2012
Distribution: Ubuntu 12.04
Posts: 22

Rep: Reputation: Disabled
Not able to import MySQL database using SSH


Hi Guys,

Today I was importing my wordpress database (from shared hosting) to my new VPS having nginx, mysql and php on Ubuntu 11.10

I ftp'd my wordpress database(wp_db.sql) to my VPS and then I cd'd into the directory containing the wp_db.sql, now I created a new database in mysql named wordpress using phpmyadmin and then I ran the following command to import wp_db.sql into wordpress database:

Code:
mysql -u root -p wordpress < wp_db.sql
I was prompted for password which I entered and got the following error:

Quote:
ERROR 1064 (42000) at line 1: 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 'mysql Ver 14.14 Distrib 5.1.63, for debian-linux-gnu (i686) using readline 6.2
' at line 1
I don't know what syntax problem is causing this error, I tried many versions of the above command but everytime I get the same error

Please Help

Thanks

Last edited by dreamcoder; 08-02-2012 at 09:03 AM.
 
Old 08-02-2012, 09:44 AM   #2
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,474

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
It's not your command like that's causing the problems it's something in your wp_db.sql file that has a command that's wrong.
 
Old 08-02-2012, 10:04 AM   #3
lithos
Senior Member
 
Registered: Jan 2010
Location: SI : 45.9531, 15.4894
Distribution: CentOS, OpenNA/Trustix, testing desktop openSuse 12.1 /Cinnamon/KDE4.8
Posts: 1,144

Rep: Reputation: 217Reputation: 217Reputation: 217
[QUOTE=dreamcoder;4744108]

I was prompted for password which I entered and got the following error:
Quote:
... at line 1: You have an error in your SQL syntax; ...[/code]
Can you post the first few lines of your "wp_db.sql"
to see what's in there.
 
Old 08-02-2012, 10:19 AM   #4
dreamcoder
LQ Newbie
 
Registered: Jul 2012
Distribution: Ubuntu 12.04
Posts: 22

Original Poster
Rep: Reputation: Disabled
[QUOTE=lithos;4744184]
Quote:
Originally Posted by dreamcoder View Post

I was prompted for password which I entered and got the following error:


Can you post the first few lines of your "wp_db.sql"
to see what's in there.

wp_db.sql contains many wp tables, I don't know which table has the wrong syntax causing this error

Is there any way to find it out ??
 
Old 08-03-2012, 01:58 AM   #5
lithos
Senior Member
 
Registered: Jan 2010
Location: SI : 45.9531, 15.4894
Distribution: CentOS, OpenNA/Trustix, testing desktop openSuse 12.1 /Cinnamon/KDE4.8
Posts: 1,144

Rep: Reputation: 217Reputation: 217Reputation: 217
Did you dump the database to file ?

then you get a "text" file, so post first few lines... (# head wp_db.sql)

Last edited by lithos; 08-03-2012 at 02:00 AM.
 
1 members found this post helpful.
Old 08-03-2012, 06:49 AM   #6
dreamcoder
LQ Newbie
 
Registered: Jul 2012
Distribution: Ubuntu 12.04
Posts: 22

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by lithos View Post
Did you dump the database to file ?

then you get a "text" file, so post first few lines... (# head wp_db.sql)

Thanks a lot bro, the problem was indeed in the .sql file

I re-exported the full database (from my shared hosting) as .sql using a plugin - backupwordpress and then ftp'd this exported database to my vps and then ran the command:
Quote:
mysql -u root -p wordpress < new_db.sql
, it imported the db perfectly!!

I think the problem arised because phpmyadmin (on my shared hosting) was not exporting the 500MB database properly (still don't know why)


Anyways, thanks a lot for your hint mate
 
Old 08-03-2012, 08:50 AM   #7
lithos
Senior Member
 
Registered: Jan 2010
Location: SI : 45.9531, 15.4894
Distribution: CentOS, OpenNA/Trustix, testing desktop openSuse 12.1 /Cinnamon/KDE4.8
Posts: 1,144

Rep: Reputation: 217Reputation: 217Reputation: 217
Great,
I'm glad to see you worked it out.
Thanks for posting back.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
MySQL Database Import ballistic509 Linux - Server 4 03-31-2007 01:26 AM
MYSQL Database Import Behrooz_Ice Linux - General 2 09-08-2006 04:15 AM
MySQL Database Import sbb Linux - Software 1 06-04-2006 11:15 AM
MySQL import database akines Linux - Software 3 04-19-2006 01:14 AM
How to import a mysql database from backup WindowBreaker Slackware 6 03-16-2006 11:08 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:44 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration