Jump to content


Photo

import a txt file from the command line


  • Please log in to reply
3 replies to this topic

#1 jimath

jimath
  • Members
  • PipPipPip
  • Advanced Member
  • 46 posts

Posted 03 October 2006 - 05:16 PM

hi everone!

could anyone tell me how i can import a txt file with sql commands
from the mysql command line?
the following doesnt help me.
mysqladmin create nuke
mysql nuke<nuke.sql

i have the txt file in a folder into htdocs and i want to run it.
i am already connected to mysql as root.
mysql>
thanks!

#2 effigy

effigy
  • Staff Alumni
  • Advanced Member
  • 3,600 posts
  • LocationIL

Posted 03 October 2006 - 05:33 PM

Try mysql database < /full/path/to/file. You may also need to specify the -p option if it is not on by default in your configuration file: mysql -p database < /full/path/to/file. What error messages are you getting?
Regexp | Unicode Article | Letter Database
/\A(e)?((1)?ff(?:(?:ig)?y)?|f(?:ig)?)\z/

#3 jimath

jimath
  • Members
  • PipPipPip
  • Advanced Member
  • 46 posts

Posted 03 October 2006 - 05:58 PM

i write this
mysql> mysql -p nuke <C:\Program Files\Apache Group\Apache2\htdocs\PHP-Nuke-7.8\sql\nuke.sql

and its displayed the -> arrow.
i have created the database (nuke).

#4 effigy

effigy
  • Staff Alumni
  • Advanced Member
  • 3,600 posts
  • LocationIL

Posted 03 October 2006 - 06:36 PM

Ah. I was thinking the OS's command line, not MySQL's (I see you specified that). From the MySQL command line you can use \. file or source file. Use \h to see what else you can do.
Regexp | Unicode Article | Letter Database
/\A(e)?((1)?ff(?:(?:ig)?y)?|f(?:ig)?)\z/




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users