Posted by nick | Posted in MySQL | Posted on Dec 24 2009
Tags: command line, MySQL
Today I needed to import a 4.5GB file of SQL into a MySQL database. Good ole phpmyadmin won’t handle anything close to that large, I it had to be command line. It took me a bit to find the proper syntax, so hopefully this will rank well and provide a quick reference not only to myself but to everybody else.
Save your text file of SQL somewhere on your computer and open a command window (start > run and type “cmd” and hit enter). Type the following command
1. mysql -u root -p (then hit enter. “root” is the database username you’re using)
2. It’ll then prompt you to enter the password for that user. Enter it and hit enter.
3. type “USE databaseName” and hit enter. (”databaseName” must be changed to whatever your database name is).
4. the final step is to use the “source” command and provide the location of your text file on your hard drive like source C:\dump.sql