Mellon
Mellon

Reputation: 38922

The differences between the two actions in mysql

If I have a MySQL dump file: my_dump.sql

What are the differences between the following two actions from command line? (I don't have password for mysql)

Action 1:

 mysql -u root my_database < my_dump.sql

Action 2 (consists of 3 steps):

step 1: Login to mysql:

mysql -u root -p

step 2: use my_database:

use my_database

step 3: execute sql script in the dump file:

 source my_dump.sql

Are the above two actions doing exactly the same thing or there are some differences behind the scene?

Upvotes: 0

Views: 144

Answers (1)

Mithun Sasidharan
Mithun Sasidharan

Reputation: 20950

Both are two different ways of performing the same task.

also specify the path of the dump file along with the sql file

For eg :

$> source /home/my_dump.sql;

Upvotes: 1

Related Questions