Reputation: 141
I am trying to import a 60 MB file, filename-20120201.tbz, into a newly created MySQL database. I am using terminal, and have opened the database by the prompt use new_database.
How do I import this file correctly? I am on a Mac. Thanks.
Upvotes: 13
Views: 35963
Reputation: 4942
Try
$ mysql -u root -p new_database < db-dump.sql
Where: new_database is the name of your new database and db-dump.sql is the mysql file to be imported
Upvotes: 11
Reputation: 4601
If you are running mysql and using your newly created database use the below code to run the script file
mysql> SOURCE input_file
or from terminal
mysql -u root -p database < filename-20120201.tbz
Upvotes: 27
Reputation: 31647
Place the password immediately after -p
mysql -u root -ppassword database < file.sql
Upvotes: 0
Reputation: 137430
This should do the trick:
\. filename
(provided within MySQL's command line, assuming filename
is SQL file)
Upvotes: 3