LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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 02-25-2008, 08:22 AM   #1
mohtasham1983
Member
 
Registered: Apr 2005
Location: San Jose
Distribution: Fedora 3,4- Ubuntu 6.06 to 8.10, Gentoo and Arch
Posts: 408

Rep: Reputation: 30
Recovering MySQL database


Hi,

I was trying to change the name of the database in my local computer to the same one in my public domain using phpmyadmin, but I got some error messages and after that I lost many tables in it. Fortunately, I have several back ups of my public database. I created a new database and then used source command to recover my website, but in my surprise at some point it gave me error 1064. I googled it and it said that:You will get a MySQL query syntax error number 1064 when you incorrectly use a reserved word in your query such as "when" or "order".

I have created that backup file from my public domain database using cpanel, which i guess uses mysqldump, but I don't know why I cannot recover it on my computer.

Any idea how to do it?
 
Old 02-25-2008, 09:25 AM   #2
mtimbro
Member
 
Registered: Feb 2008
Location: Montreal, Canada
Distribution: RedHat 3/4, Ubuntu 7.10
Posts: 86

Rep: Reputation: 15
Exclamation

Quote:
Originally Posted by mohtasham1983 View Post
Hi,

I was trying to change the name of the database in my local computer to the same one in my public domain using phpmyadmin, but I got some error messages and after that I lost many tables in it. Fortunately, I have several back ups of my public database. I created a new database and then used source command to recover my website, but in my surprise at some point it gave me error 1064. I googled it and it said that:You will get a MySQL query syntax error number 1064 when you incorrectly use a reserved word in your query such as "when" or "order".

I have created that backup file from my public domain database using cpanel, which i guess uses mysqldump, but I don't know why I cannot recover it on my computer.

Any idea how to do it?
Hi there,

Do you have command line access to the server ? This can help if you do...

Find your .sql backup file (I'm also assuming that cpanel used mysqldump and that you have a .sql file) and then you simply have to run this:

mysql < dbname.sql

You can also do this remotely provided you have access to the server where your backup is from your new one:

mysql -p -h DBSERVER dbname < dbname.sql

Cheers,
 
Old 02-25-2008, 09:29 AM   #3
mohtasham1983
Member
 
Registered: Apr 2005
Location: San Jose
Distribution: Fedora 3,4- Ubuntu 6.06 to 8.10, Gentoo and Arch
Posts: 408

Original Poster
Rep: Reputation: 30
Unfortunately, I don't have access to terminal, since my server is a shared one.
 
Old 02-25-2008, 10:27 AM   #4
forrestt
Senior Member
 
Registered: Mar 2004
Location: Cary, NC, USA
Distribution: Fedora, Kubuntu, RedHat, CentOS, SuSe
Posts: 1,288

Rep: Reputation: 99
Can you read the dump file? It may be trying to create a database/table that already exists or it may not be using the database when it tries to create the tables. If you look at the first few lines of the dump file, it will probably tell you what it is trying to do. If you can't figure it out from that, post the first 20 lines or so of your dump file.

HTH

Forrest
 
Old 02-25-2008, 11:00 AM   #5
mohtasham1983
Member
 
Registered: Apr 2005
Location: San Jose
Distribution: Fedora 3,4- Ubuntu 6.06 to 8.10, Gentoo and Arch
Posts: 408

Original Poster
Rep: Reputation: 30
Actually it creates 5 tables. I guess inside the 6th table there are some weired characters that don't let me perform my query. The table is very big, that s why it s very hard to identify where the problem is coming from.
 
Old 02-25-2008, 11:05 AM   #6
forrestt
Senior Member
 
Registered: Mar 2004
Location: Cary, NC, USA
Distribution: Fedora, Kubuntu, RedHat, CentOS, SuSe
Posts: 1,288

Rep: Reputation: 99
Well, if it creates 5 tables, then the problem is probably in the 5th table or the CREATE portion of the 6th table. Look at the 6th table's create and see if it doesn't have any strange problems, then look at the insert statements from the 5th table. You can run "select count(*) from table_5;" to see how many lines got inserted in that table to give you a place to start looking.

HTH

Forrest
 
  


Reply



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 - can't access mysql database as root yogaboy Linux - Software 5 12-28-2006 06:58 AM
help recovering database file in open office mifan Linux - Software 2 07-06-2006 05:18 PM
Recovering a mysql database irvken Linux - Software 2 10-09-2005 05:27 PM
Writing an app that uses a mysql database without installing mysql server? QtCoder Programming 4 08-09-2004 02:43 PM
MYSQL help - mysql database missing eloviyandhi Linux - Software 1 03-20-2004 09:20 PM

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

All times are GMT -5. The time now is 08:48 AM.

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