Loading a dump file, how?

liunx

Guest
Hi everyone,

Im new to mysql soi please help. Ok im trying to install to my site this pre-made chat applet that i downladed. What is says is that i have to first create two databases. Ok i did that. Now it gives me a dump file that i have to laod to each of the databases. My friend told me i could just type the info into mysql and it would work. BUT there is sooooooooooooo much info to type.

Does anyone know an easy to use utility to load dump files into mysql?1) Copy the file to your mysql folder
2) Type the following:c:\mysql\bin> mysql
mysql> LOAD DATA INFILE filename.extIf the mysql command does not work then this maybe because you do not have MySQL 'FILE' privileges. In which case use this slower, but failsafe method:c:\mysql\bin> mysql
mysql> LOAD DATA LOCAL INFILE filename.extThat should do it. Post back if you have probs.Hey thanx for the help,

this is basicly what i did and this is what happend
-i typed "mysql -umyusername -pmypassword"
-then "conenct nameofdatabase"
then i typed the command in and it gave me this

mysql> LOAD DATA LOCAL INFILE live_db.txt;
ERROR 1064: 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 'live_db.txt'
at line 1

what happened? i got the newest stable release of mysql jus so u know. I dont even knwo anything about dump files. Here is a bit of the dump file. Can you tell me if this is one that i can load like that into the database? I tried it as is and also i tried cleaning out everything with a "#" in front of it and it said the same thing.


# MySQL dump 4.0
#
# Host: localhost Database: uc_livedb
#--------------------------------------------------------

# db name should be..: uc_livedb

#
# Table structure for table 'chat_rooms'
#
CREATE TABLE chat_rooms (
ID int(11) DEFAULT '0' NOT NULL auto_increment,
location_desc char(61),
room_limit int(11),
PRIMARY KEY (ID)
);

#
# Dumping data for table 'chat_rooms'
#

INSERT INTO chat_rooms VALUES (9,'The Library',20);
INSERT INTO chat_rooms VALUES (8,'The Garden',40);
INSERT INTO chat_rooms VALUES (7,'The Bar',40);
INSERT INTO chat_rooms VALUES (6,'40\'s',40);
INSERT INTO chat_rooms VALUES (5,'30\'s',40);
blah blah blah more jibberish i know nothing about...Sorry, you need to place the filename.ext within single-quotes. My Bad!

LOAD DATA INFILE 'filename.ext';

or

LOAD DATA LOCAL INFILE 'filename.ext';you said 'filename.ext' mine are just txt files? are they the wrong format? or does it matter?

it gave me the syntax message again.ext = extension (it can be anything you like)

Can you take a screen dump of the command you are using and the error? I'm sure the command syntax I have given is correct. You have remembered to copy the file to the c:\mysql folder (or wherever your mysql is installed)?ooh thanx, makes sence.

no im sure u are right. i just cant figure out what im doing wrong.

I included a print screen of my dos window

<!-- m --><a class="postlink" href="http://grewal.mine.nu/untitled.jpgAhhhhhh">http://grewal.mine.nu/untitled.jpgAhhhhhh</a><!-- m -->! I just noticed that you text file actually contains the SQL statements and not just the data you want to insert. Sorry mate, I lead you up the garden path there a bit.

This is even easier. Use the following command (at the mysql> prompt).

mysql> source <path>/<filename.ext>

That should do it.Originally posted by torrent
1) Copy the file to your mysql folder
2) Type the following:c:\mysql\bin> mysql
mysql> LOAD DATA INFILE filename.extIf the mysql command does not work then this maybe because you do not have MySQL 'FILE' privileges. In which case use this slower, but failsafe method:c:\mysql\bin> mysql
mysql> LOAD DATA LOCAL INFILE filename.extThat should do it. Post back if you have probs.
and hope that he doesn't start mysql with mysqld

or you can Download phpMyAdmin (<!-- m --><a class="postlink" href="http://www.phpmyadmin.net">http://www.phpmyadmin.net</a><!-- m -->)

and make it all easy. :)

what OS are you on bruno?Although the command I listed was mysql and not mysqld. It's a bit like telling someone to use the copy command and hoping they don't use the del one instead ;)


phpMyAdmin is all well and good but you can never beat gaining a good understanding of the underlying database's commands. In addition, commands are often quicker once you know them than loading up phpMyAdmin and navigating the interface. Having said that, I pretty much use phpMyAdmin on my remote server all the time.My os is Win 2000, i didnt use iss cuz i dont like it. I like Apache.

Well you say mysql vs. mysqld is like copy and del. im new to mysql so i dont know the diff between the two. I do like learning the underlying commands but im more content knowing how it works and having it actualy work. But thanx i'll give that Download a try.Bruno, to be honest a simple question has been made to sound confusing when it really isn't.

All you need to do is to type:

source <path\<file>

at the mysql prompt.

Done! :)the only reason I suggested that he not use mysqld command to start mysql is because LOAD DATA LOCAL INFILE wouldn't work. :)

but if you don't Download phpmyadmin then what torrent suggested will work just fine. and it doesn't matter waht os you have. then again you start mysql with mysql-nt I believethanx you guys, i figured it out.
 
Top