|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
How to import txtfiles into mysql database
Hi all:
How to import txtfiles into mysql databases. I know the command. But i do not know where I should put this file. Anyone gives me a hint Cheers Andy |
|
#2
|
|||
|
|||
|
A good example is to take your web server's raw access log and import it into mysql with a command such as this:
C:\temp\>mysqlimport --local -d -r -h <host> -u <user> -p<password> --fields-terminated-by="-" <dbname> <textfile> This assumes the textfile is in the c:\temp directory which is your current working directory. It is very imporant you use the command line switch --local as if you do not, the mysql server will attempt to look on it's hard drive for the textfile you specified. Most likely it will not find it.
__________________
__________________________________________________ _ Wil Moore III, MCP | Integrations Specialist | Senior Consultant Are You Listed...? | DigitallySmooth Inc. |
|
#3
|
|||
|
|||
|
You can also use a query with
LOAD DATA INFILE 'file.txt' INTO TABLE table (fields); |
|
#4
|
|||
|
|||
|
ok, so how would i do this in OS X? what's the default path?
|
|
#5
|
|||
|
|||
|
There is no default path... you need to cd to whatever directory you have the file in or reference the full path to the file you are importing.
|
|
#6
|
|||
|
|||
|
tried that
yeah, well, i tried that but i must have missed the path. anyway, i just got a GUI to mysql so i dont need it right now. i'm sure in the future, importing a text file will be quicker than typing it all in. thanks for replying, though, i really appreciate it.
|
![]() |
| Viewing: Dev Articles Community Forums > Databases > MySQL Development > How to import txtfiles into mysql database |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|