Reputation: 487
I have a large .sql
. file and I'm trying to import it by using command line. Im going to the right directory and typing:
mysql -u rookie -h 127.0.0.1 -p database < file.sql
And somehow it gives me an error:
Mysql is not recognized as an internal or external command
Why?
Upvotes: 1
Views: 362
Reputation: 1737
Linux can't find the binary mysql
.
Quick fix:
Check the location of the mysql
binary with the following command: which mysql
.
You will then see output similar to the following:
/usr/bin/mysql
Rewrite your command as:
/usr/bin/mysql -u rookie -h 127.0.0.1 -p database < file.sql
Longterm solution:
Add mysql
to your $PATH
environment variable like so:
export PATH=$PATH:/usr/bin/mysql
(of course put your own mysql
path at the end here.)
Upvotes: 1