Jump to content


Photo

Running SQL files through MySQL


  • Please log in to reply
2 replies to this topic

#1 pl

pl
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 14 January 2003 - 09:25 PM

Can anyone tell me how I run an SQL file through MySQL for creating databases and inserting database information. This type of information tells me nothing:

> mysql -h host -u user db pass < filexxx.sql

I need to know where to place the SQL file and how to run it accordingly.

Thanks...

#2 effigy

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

Posted 14 January 2003 - 11:42 PM

mysql database_name < path_to_file

breakdown:

mysql this executes mysql on the command line
database_name this tells mysql what database to use the file on
< this is a special symbol in unix for telling the command, in this case mysql, to use the following file as input
path_to_file this is the path to a file containing SQL

the -h -u and so on are parameters that are sometimes needed. to make things easier you can set these in the my.cnf file, or you may not have to use them at all.
Regexp | Unicode Article | Letter Database
/\A(e)?((1)?ff(?:(?:ig)?y)?|f(?:ig)?)\z/

#3 pl

pl
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 15 January 2003 - 12:55 AM

Thanks for that!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users