MySQL import via command line on windows
0Today 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
Hi I'm Nick Bartlett and thanks for visiting my blog. I'm not much of a writer; many of my posts are short and to the point while others are meant to be a reference for myself and other web developers.