Hello Support Im trying to import a lot of rows into my database MySQL using DigitalOceam Databases, but i cant connect it using LOAD DATA, and I need to import a file CSV in a performant way. I dont have idea if it is possible do this using this database because seems no there a way to upload the file and then run an LOAD DATA LOCAL INFILE query insert… I cant set global local_infile=1, it is posible? Could do you help me? Thank you
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Sign up for Infrastructure as a Newsletter.
Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Hey!
The available configuration options that you can change for the Managed MySQL database clusters are available here:
Unfortunately
local_infile
is not configurable. You can try reaching out to the DigitalOcean support team who might be able to enable this for you:However, as in a managed database service, direct access to the database server’s filesystem is restricted for security and operational reasons. This means traditional methods of directly placing a file on the server and loading it into the database might not be directly applicable.
You can try using a tool like MySQL Workbench or a similar tool. As some of the database management tools offer features to import data from CSV files into your database without directly using the
LOAD DATA LOCAL INFILE
command.An alternative option would be to write a small script in a language like Python, PHP, or Node.js to read the CSV file and insert rows into the database using individual
INSERT
statements or batch insertions. While not as fast asLOAD DATA LOCAL INFILE
, that way you will have more control and can be adapted to match the managed database requirements.Hope that helps!
- Bobby.