Category Covered

Import mysql database on windows command

You have to follow the step to restore or import database on local windows desktop or laptop.

Step 1: Open your command line from start->write "cmd" on the input text box and press enter.

Step 2: Now locate to your mysql bin directory here my bin located on "D:\wamp\bin\mysql\mysql5.5.20\bin"

Step 3: Process to local. Press "d:" and enter, then write cd and the path like "cd D:\wamp\bin\mysql\mysql5.5.20\bin" and press enter.

Step 4: Write  "mysql -u root -p" enter

Step 5: Give your password if you have or press enter.

Step 6: If you dont have the database then create a database using "create database beanmd" and press enter. Here beanmd is a sample database name.

Step 7: As you create the new database so you have to set privilegs. Here is the way to set privilegs

//HOW TO SET PRIVILEGES ON DATABASE USING SHELL SCRIPT ON LINUX
mysql> grant all privileges on beanmd.* to root;
mysql> flush privileges;

Now its the time to import sql file to the database

Step 8: My source file located on "E:\beanmd". So press "E:\beanmd\filename.sql"

Done.

shell script mysql important command for linux