3

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.

1
  • > is export, < is import Commented Jan 30, 2017 at 17:00

1 Answer 1

4

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
Sign up to request clarification or add additional context in comments.

2 Comments

Hmm, going to try this right now. In the mean time, what is the > chevron that I was using intended to do?
> redirects output to a file, overwriting the file if it already exists.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.