0

Goal

My goal is to insert BLOB data into MySQL from various paths - NOT just MySQL server host folder.

Where I am at now

I am able to write a query using load_file() function using this path only - C:\ProgramData\MySQL\MySQL Server 8.0\Uploads

Problem

When using any other paths such as the \Desktop - MySQL values show as NULL.

As the documentation states "To use this function, the file must be located on the server host."

Question

How can I GRANT or enable privilege to use load_file() for any path?

Root Grant Privileges

GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE, CREATE ROLE, DROP ROLE ON *.* TO "root"@"%" WITH GRANT OPTION

EDIT:

Got something out of here: https://stackoverflow.com/a/42410342/12485722

"If you need to change the path, you must do it in the my.ini file:"

" Secure File Priv. secure-file-priv="V:/NEW/PATH/TO/MySQL Server/Files" "

How can I add multiple paths in the .ini file?

Eduards
  • 1,734
  • 2
  • 12
  • 37
  • If you have the files in same drive you could use only the drive letter like `secure-file-priv = "C:/"` or if more then add multiple lines mentioning the drive letter. This should be added in your config file. – James Dec 23 '19 at 09:36
  • sorry i can't get you – James Dec 23 '19 at 09:47

0 Answers0