Lately I had the opportunity to work on a project where we had to migrate from a PHP + Vertica to nodeJS + Aurora Serverless.
There was a lot going on there, on which I had very little experience with.
I watched Udemy courses, read tons of documentation and followed tutorials. I had already made a whole lot then ** I got stuck** at a weird error:
Error: Access denied for user 'MY_USER'@'%' (using password: YES)
Why Access Denied? I could already connect to the new DB, create all the tables - even insert single rows to them, why would the loading of the CSV files into the table fail because of credentials or permissions?
The SQL query was simple:
LOAD DATA INFILE '${filename}'
INTO TABLE ${table}
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
IGNORE 1 ROWS;`
Googling for that error I found stuff on Stack overflow which pointed me in the wrong direction - user access, user creation, permissions on the tables. Then I quickly asked a colleague which, without even checking my script, simply rephrased my search and set me back on track.
As expected the solution had nothing to do with Access Denied and if i had read (more carefully) the documentation of LOAD DATA INFILE i would have known that
if LOCAL is not specified, the file must be located on the server host and is read directly by the server. If LOCAL is specified, the file is read by the client program on the client host and sent to the server.
Fazit:
- RTFM
- google it ( rephrasing often )
- once you found your solution - do not only copy paste it but understand it and read more about it, otherwise you learned nothing from it
- don't be afraid to ask when you are stuck
Top comments (0)