Barry Chapman
Barry Chapman

Reputation: 6780

How do I load a local .SQL file into MySQL?

I have a 56mb file on my web server, and I would like to (I think) use INFILE to load a filename.SQL file into mysql.

I don't really want to upload it because that will just take too long, but I would like to just use the local file on the system to import into mysql. The file contains the table creation instructions already so I don't need to specify the target, just execute the SQL as is in the file.

Upvotes: 1

Views: 5121

Answers (2)

thunderflower
thunderflower

Reputation: 181

The easiest way is to pass it in as a stream from the command prompt. Something like this:

mysql -u theuser -D thedatabase < filename.SQL

Upvotes: 2

trailmax
trailmax

Reputation: 35126

login to mysql command line environment and do:

mysql> source file_name.sql

Upvotes: 4

Related Questions