0

I am trying to use DDL scripts in mySQL but I get the following error, which is related to not being able to find the file path.

mysql> source filename

"Failed to open file 'filename', error: 2"

I am working in OS X. Is there a mySQL directory somewhere? Please help!

Additionally, any resources to understand OS X file paths/hierarchy would be much appreciated!

mel
  • 25
  • 1
  • 5
  • check out http://stackoverflow.com/a/7459142/1816093 – Drew Sep 11 '15 at 23:45
  • try `show variables where variable_name like'data%';` – Drew Sep 11 '15 at 23:45
  • The only problem, @Drew, is that ddl scripts should not be stored in the datadir. That's mysql's turf, not user turf. No user-serviceable parts. – Michael - sqlbot Sep 12 '15 at 02:48
  • honestly, @Michael-sqlbot, I was zoomed in on this part of it `Is there a mySQL directory somewhere?` As far as I know, she is on an Airbook, and her mysql is Amazon Linux AMI – Drew Sep 12 '15 at 02:55
  • that said, that so called mysql turf is the output directory of outfile commands, which seems a little user-turf to me. Now going below that, into schema folders, and intermingling .sql with .frm and .ibd, that is mysql turf – Drew Sep 12 '15 at 03:01

1 Answers1

0

You can store then wherever makes sense. The catch is that when you source them, you need to either already be in that directory before running the initial mysql command, because source only looks in the current directory -- that's why they aren't found, not because you put them in the "wrong" place, if that's what you're thinking may be the problem.

Or, use the full path, e.g.:

mysql> source /home/melissa/myscript.sql
Michael - sqlbot
  • 169,571
  • 25
  • 353
  • 427
  • Thank you! I didn't understand source, so thanks for telling me that the file needed to be in the current directory. – mel Sep 14 '15 at 16:52