How to Import a SQL file into MySQL on Windows
This is a small code snippet on how to import a SQL file into MySQL on Windows.
- First change to the MySQL Directory
- Now change into the bin directory
- Now run this command:
mysql -u USERNAME -pPASSWORD -h localhost DATABASENAME < c:\\DIR1\\DIR2\\DATA.SQL
I capitalized all the potential variables above (so USERNAME is your username to mysql). Pay attention to the letter “p” before the password. So if your username is testuser, and your password is 12345, and your database is called testdb, then the command will be:
mysql -u testuser -p12345 -h localhost testdb < c:\\DIR1\\DIR2\\DATA.SQL
You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
Leave a Reply