MySQL database import using Command Line under Windows

Description:

Import larger databases can cause timeouts or errors in phpMyAdmin. For this situations we need to use the command line import.

Solution:

The file we need is mysql.exe situated in the xampp directory under \xampp\mysql\bin\ . Then 2 steps are required: log in and import the database:

mysql -u [username]

source [path_to_sql_dump] (eventually select required database with “use [db_name]”)


In just one line we can do it the following way, clean and easy:

mysql -u [username] -p [db_name] < [db_dump.sql]

Advertisements

About admin

Just another php developer trying to give something back to the community.
This entry was posted in SQL and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s