I am trying to connect a Google Apps Script to a local MySQL (8.0.11) database on MacOS. I have setup the DB, my.cnf file, installed MySQL Workbench. I have created a new db and can insert rows and query. However, when I try to connect in Apps Script, I keep getting the error:
Failed to establish a database connection. Check connection string, username and password.
Failing consistently at this line of code:
var conn = Jdbc.getConnection('jdbc:mysql://localhost:3306/mydb', 'root', 'pass');
I have tried a variants of the connection string, e.g.:
var conn = Jdbc.getConnection('jdbc:mysql://10.10.10.10:3306/mydb', 'root', 'pass');
I have confirmed use of port 3306. I have been unsuccessful at whitelisting Google's IP address, and consistently get syntax errors with:
GRANT ALL PRIVILEGES ON *.* TO 'root@64.%.%.%';
Getting error:
Error Code: 1410. You are not allowed to create a user with GRANT
What am I missing?
Edit: gave up and was successful using Python and a few manual steps. Works much faster than Google Apps Script.