LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-22-2004, 12:57 PM   #1
patpawlowski
Member
 
Registered: Mar 2003
Location: Centreville, Virginia
Distribution: Mandrak, Red Hat
Posts: 163

Rep: Reputation: 30
Loading sql dumpfile into mySQL


I have an SQL dumpfile that was converted from access. It looks basically like a SQL script (see below). Does anyone know how I can load this, or run this from the mysql command line?

Thanks,

pat pawlowski


DROP TABLE IF EXISTS `cat_index`;
CREATE TABLE `cat_index` (
`cat_index_id` INT NOT NULL AUTO_INCREMENT,
`cat_id` INT NOT NULL DEFAULT 0,
`sub_cat_id` INT NOT NULL DEFAULT 0,
`sub_cat_sort` INT DEFAULT 20,
INDEX `cat_id` (`cat_id`),
INDEX `cat_index_id` (`cat_index_id`),
PRIMARY KEY `PrimaryKey` (`cat_index_id`),
INDEX `sub_cat_id` (`sub_cat_id`)
);

#
# Dumping data for table 'cat_index'
#

LOCK TABLES `cat_index` WRITE;
INSERT INTO `cat_index` VALUES(40, 2, 1, 1);
INSERT INTO `cat_index` VALUES(41, 2, 2, 2);
INSERT INTO `cat_index` VALUES(42, 2, 3, 5);
INSERT INTO `cat_index` VALUES(44, 2, 5, 8);
INSERT INTO `cat_index` VALUES(45, 2, 6, 7);
INSERT INTO `cat_index` VALUES(48, 3, 8, 1);
 
Old 01-22-2004, 01:03 PM   #2
ricstirato
Member
 
Registered: Jan 2004
Location: Gießen, Germany
Distribution: Xubuntu 12.04, Mythbuntu, Ubuntu Server 12.04
Posts: 174

Rep: Reputation: 24
The following should work:

mysql -u username -p database_name < filename

If you don't use passwords, drop the "-p" option.
 
Old 01-24-2004, 08:01 AM   #3
patpawlowski
Member
 
Registered: Mar 2003
Location: Centreville, Virginia
Distribution: Mandrak, Red Hat
Posts: 163

Original Poster
Rep: Reputation: 30
Worked like a charm. I wish I could solve all my computer questions that easily.
 
  


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 - interchangable with MS SQL Server sirpimpsalot Linux - Newbie 5 06-04-2004 02:13 PM
mysql sql statement help mrtwice Programming 4 12-02-2003 10:04 AM
SQL mySQL PHP and Sessions poeta_boy Programming 15 11-26-2003 06:36 PM
SQL in MySQL oulevon Programming 1 12-06-2002 11:33 AM
MS SQL to MySQL jayakrishnan Linux - General 0 03-22-2002 03:17 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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