Thursday 23 January 2014

Importing mysql database in wamp using mysql command line


For big databases it is usually good practice to import it using command line. Most of the times you will face problems while importing databases with php my admin.

Following is a step by step procedure to import database with command line.

1) Start wamp server and click on tray icon (windows). Icon is located at bottom-right near the computer clock.

1.1) You need to create an empty database. Use following command to create a new database

create database database_name.

e.g. : create database my_database

2) Go to mysql and select MYSQL Console and switch to your database with the following command

use my_database;

3) //this step is for your own convenience.

Copy your database file (remember not the zip file, but the text file. If you have backup in zip format, first extract it.)

4) Go to MySQL shell and type the following command

mysql> source path_to_your_sql_file

For example , file is laying in C:\

so type the following command

mysql> source C:\db_backup.sql

No comments:

Post a Comment