Importing CSV File to mariadb
Hello, I am getting the error statement below when I try to import a csv file to mariadb. How can I be able to solve it?
Error statement ; As a result of LOCAL INFILE command server wants to read C:/Users/Charles Msilanga/Desktop/SQL Practice/bank data.csv file, but as of v2.0 you must provide streamFactory option returning ReadStream.
Thank you
Answer Answered by Ian Gilfillan in this comment.
Please give full details in a question in order for someone to be more likely to help. What are you using to connect to MariaDB? There is no version 2 of MariaDB Server, perhaps you are using Node MySQL 2? I see this thread saying that node-mysql2 does not allow local access, but gives a possible workaround.
Or else try MariaDB Connector/Node.js which has the permitLocalInfile
parameter, which should help you.
mariadb.createConnection({ host: 'FULLY_QUALIFIED_DOMAIN_NAME', port: 'TCP_PORT', user:'DATABASE_USER', password: 'DATABASE_PASSWORD', permitLocalInfile: 'true' });