I have a test suite that produces a .json file. I want to store the JSON file in MYSQL. I do not care how it stores it. I just want it in there so I can pull it out.
After researching this online, I tried to do the traditional route through the GUI using Table Data Import Wizard:
I met with the following error:
Can't analyse file. Please try to change encoding type. If that doesn't help, maybe the file is not: json, or the file is empty.
The file is clearly not empty, and the file is valid JSON. I even went so far as to put it into an online tool that validates JSON. I looked online and other people have had this problem. So I changed the encoding to every option available in Notepad++. These include:
- ANSI
- UTF-8
- UTF-8-BOM
- UCS-2-BE-BOM
- UCS-2-LE-BOM
Again, I still get the same error message. So I looked this up like a good stack overflow user so that everybody doesn't yell at me, and I see that this was identified and verified as a bug in April of 2019. This was in the 8.0.15 build. I am using the 8.0.19. I don't know if this was ever resolved because I require an Oracle account to view the progress logs (for some awesome unexplained reason).
So I took an alternative route and just tried punching in the SQL Queries directly into My SQL Workbench. Big surprise, it doesn't work:
I get error 1290, which reads:
Error Code: 1290. The MySQL server is running with the --secure-file-priv option so it cannot execute this statement.
I checked stack overflow and tried the following solutions:
- commenting out --secure-file-priv setting in the linked my.ini file
- placing the json file directly into the "uploads" folder that the --secure-file-priv points to
- restarting MySQL / my computer'
None of these worked. It also suggested replacing "\" with "/" in the filepath on that same page, but I fail to see where you would replace it. Replacing it in the filepath to the .json file in the query results in the same error. I don't see how you'd replace it on the path to executable, as there's no option to do that.
Before everyone starts throwing things, here is some basic information everyone asks for:
- I'm Using Windows 10
- This is MySQL Workbench 8.0.19
- This is using MySQL Server 8.0
If someone actually knows how to fix this, I'd be very happy.
I'm using windows 10