LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 03-15-2006, 06:13 PM   #1
WindowBreaker
Member
 
Registered: Oct 2005
Distribution: Slackware
Posts: 228

Rep: Reputation: 31
How to import a mysql database from backup


I'm trying to import a mysql database backup into a new computer.

I used webmin's mysql module to create the backup file. The name of the database I backed up was 'rt3'. The name of my backup file is 'rt3.sql'. I've already moved it over to the new machine.

I searched the mysql documentation and tried doing:
Code:
mysqlimport rt3 rt3.sql
It thinks I'm trying to import the entire file into a table called rt3, and quits with an error.
The problem is that this is a backup of an entire dB, not just a single table.

I'm no mysql expert, so any suggestions would be appreciated.

Last edited by WindowBreaker; 03-15-2006 at 06:14 PM.
 
Old 03-15-2006, 06:18 PM   #2
mdarby
Member
 
Registered: Nov 2004
Location: Columbus, Ohio
Distribution: Slackware-Current / Debian
Posts: 795

Rep: Reputation: 30
Code:
mysql -p -D rt3 < rt3.sql
 
Old 03-15-2006, 09:32 PM   #3
WindowBreaker
Member
 
Registered: Oct 2005
Distribution: Slackware
Posts: 228

Original Poster
Rep: Reputation: 31
I tried that - here's the output:
Code:
mysql -p -D rt3 < rt3.sql
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 'rt3.sql
(44,'Group',23,'WatchAsAdminCc','RT::System',1,0,0),(47,'Group',4,'Admin' at line 1
The backup is coming from a mysql v 4.1.16 (which I manually compiled), and the new system is using mysql v4.1.14 (ships with slack 10.2).

I'm assuming the version mismatch is causing the problem.

Is there any way around this - such as a platform/version independent backup process, after which I can import the entire dB into the new system?

Last edited by WindowBreaker; 03-15-2006 at 09:34 PM.
 
Old 03-16-2006, 12:55 AM   #4
willysr
Senior Member
 
Registered: Jul 2004
Location: Jogja, Indonesia
Distribution: Slackware-Current
Posts: 2,601

Rep: Reputation: 438Reputation: 438Reputation: 438Reputation: 438Reputation: 438
try using PHPMyAdmin
 
Old 03-16-2006, 01:01 PM   #5
WindowBreaker
Member
 
Registered: Oct 2005
Distribution: Slackware
Posts: 228

Original Poster
Rep: Reputation: 31
thanks for the suggestion willysr. However, I already tried it with phpmyadmin, and the following error below is given (pretty long):

Quote:
Error
There is a chance that you may have found a bug ...[cut]

-- Host: localhost Database: rt3
-- ------------------------------------------------------
-- Server version 4.1.16-log

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;

----END RAW----

SQL query:

rt3.sql0000644
MySQL dump 10.9 -- -- Host: localhost Database: rt3 -- ------------------------------------------------------ -- Server version 4.1.16-log /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;

MySQL said:
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 'rt3.sql' at line 1

Last edited by WindowBreaker; 03-16-2006 at 01:06 PM.
 
Old 03-16-2006, 07:59 PM   #6
willysr
Senior Member
 
Registered: Jul 2004
Location: Jogja, Indonesia
Distribution: Slackware-Current
Posts: 2,601

Rep: Reputation: 438Reputation: 438Reputation: 438Reputation: 438Reputation: 438
it seems that your query was not accepted by 4.1.14
maybe you can post your query file?
 
Old 03-17-2006, 12:08 AM   #7
WindowBreaker
Member
 
Registered: Oct 2005
Distribution: Slackware
Posts: 228

Original Poster
Rep: Reputation: 31
*Resolved

The problem was being caused by non-identical files. I ran an md5sum on both the original and copy, and they didn't match (even though their sizes did).

[shame on me - rookie mistake]

Then I ended up using phpmyadmin to import the file into the dB without a hitch.

Thanks to everyone for your suggestions.
 
  


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
Import Database Function Script Using Perl?? domquem Programming 3 01-13-2005 10:05 AM
Exporting MySQL error when trying to Import to another database. strez4prez Linux - Software 0 05-28-2004 12:43 PM
Editing text file for import to a spread/database Franklin Programming 7 03-31-2004 07:31 AM
Import records to MySQL Database from a shell script chrisk5527 Linux - General 12 03-24-2004 10:49 PM
Arkeia Backup Software : import Veritus Tapes 24jedi Linux - Software 0 01-07-2004 04:01 PM


All times are GMT -5. The time now is 07:53 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration