LinuxQuestions.org
Help answer threads with 0 replies.
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, 05:13 PM   #1
WindowBreaker
Member
 
Registered: Oct 2005
Distribution: Slackware
Posts: 228

Rep: Reputation: 40
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 05:14 PM.
 
Old 03-15-2006, 05: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, 08:32 PM   #3
WindowBreaker
Member
 
Registered: Oct 2005
Distribution: Slackware
Posts: 228

Original Poster
Rep: Reputation: 40
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 08:34 PM.
 
Old 03-15-2006, 11:55 PM   #4
willysr
Senior Member
 
Registered: Jul 2004
Location: Jogja, Indonesia
Distribution: Slackware-Current
Posts: 4,868

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

Original Poster
Rep: Reputation: 40
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 12:06 PM.
 
Old 03-16-2006, 06:59 PM   #6
willysr
Senior Member
 
Registered: Jul 2004
Location: Jogja, Indonesia
Distribution: Slackware-Current
Posts: 4,868

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

Original Poster
Rep: Reputation: 40
*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 09:05 AM
Exporting MySQL error when trying to Import to another database. strez4prez Linux - Software 0 05-28-2004 11:43 AM
Editing text file for import to a spread/database Franklin Programming 7 03-31-2004 06:31 AM
Import records to MySQL Database from a shell script chrisk5527 Linux - General 12 03-24-2004 09:49 PM
Arkeia Backup Software : import Veritus Tapes 24jedi Linux - Software 0 01-07-2004 03:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 12:19 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