I installed MySQL(5.7.16) using Homebrew, now I'm trying import a sql.file, here's the notification I got. Error Code: 1290( --secure-file-priv). My mac is 10.12.1. I saw the other answer and it suggested that the solution is to should add secure-file-priv = ""MySQL ERROR 1290 (HY000) --secure-file-priv option
But how can I do that on mac?
For MySQL installed via MAMP (on Mac):
Enable file i/o to/from local user account:
edit ~/.my.cnf (using vi or your favorite editor) and the following lines:
$ vi ~/.my.cnf
Now check if it works:
a. start mysql (default MAMP user is root, password is also root)
b. in mysql look at the white-listed paths
c. Finally, test by exporting a table
train
into a CSV fileI just got forced into upgrading to Sierra (10.12.1), and ended up downloading 5.7.16. I ran into the same issue where I couldn't import/export. To solve the issue, you have to include a --secure-file-priv option in your mysql command. Since I installed mysql to start automatically, the options are controlled by a plist file. On my installation, it was
Depending on OS and how you install (source, pkg, macports, etc), you're default starting process could be different. I installed from Oracle with a dmg and had this plist file controlling my startup. If you did the same, edit the plist file with sudo (I use vi):
and you should see a section that looks like
Add/edit that last line to the directory you want to import/export from/to.
When using IMPORT or EXPORT in mysql, you have to use the fullpath filename, i.e.:
Trying with just the filename won't work. The directory will also need write privileges if you plan to export (I had my directory under my personal user space and needed to make the specified directory writable to all - i.e.
That solved the issues for me.