Goose
Goose

Reputation: 4821

MySQL command line import causes sql file to become empty

I have a 8GB sql file called test.sql.

I am running this command to import it into my database called test_db.

mysql -u root -p test_db > test.sql

After a few minutes, the file test.sql is emptied so that it is 0KB.

I am unsure if this is normal and the file will be restored when the command is finished, or if something is wrong. It's been half an hour and I don't see any data imported yet.

Why is test.sql becoming emptied of it's contents when I run this MySQL import command?

I am on Ubuntu 14.04 and MySQL 5.7.13.

Upvotes: 3

Views: 1157

Answers (1)

Ike Walker
Ike Walker

Reputation: 65547

You're using the wrong chevron. Should be the left chevron (<) not the right chevron (>).

This is what you meant:

mysql -u root -p test_db < test.sql

Upvotes: 4

Related Questions