Hi,
I'm using a Arduino Mega with a Ethernet and the library MySQL_Connector/Arduino. I'm using the code below but it always says that it failed to connect.
I created the user "lecarvalho" with the password "senha123" and granted all permissions for the user. I checked if the firewall was blocking the port 3306 too. I tried connecting via terminal to the database and it connects.
What am I doing wrong?
#include "SPI.h"
#include "Ethernet.h"
#include "sha1.h"
#include "mysql.h"
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(169, 256, 1, 118);
Connector my_conn;
char user[] = "lecarvalho";
char password[] = "senha123";
void setup() {
Ethernet.begin(mac, ip);
Serial.begin(9600);
Serial.println("Connecting...");
if(my_conn.mysql_connect(ip, 3306, user, password)) {
Serial.println("Success!");
}
else {
Serial.println("Connection failed.");
}
}
Thanks!