Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

running an sql file in mac terminal

I'm stuck trying to run a mysql statement from a file - seems if I'm outside the cd usr/local/mysql/bin directory - I get a mysql command not found error, and if I'm inside it, it can't find the path to the mysql file. The mysql file is currently in my user folder. I'm supposed to be running a command like:

mysql -u user -phpuser password < path/to/file.sql

Anybody know how to get this working?

like image 675
mheavers Avatar asked Feb 27 '26 09:02

mheavers


1 Answers

If mysql is in /usr/local/mysql/bin rather than /usr/local/bin then update your PATH:

export PATH=$PATH:/usr/local/mysql/bin

In your question, you have a dash in front of the username, try:

mysql --user=phpuser --password=password < /path/to/file.sql
like image 168
Drew MacInnis Avatar answered Mar 01 '26 21:03

Drew MacInnis