Arduino Uno, Ethernet shield, MySQL I'm trying to connect my Arduino Uno with MySQL.

This is my code:

#include &lt;SPI.h&gt;
#include &lt;Ethernet.h&gt;
#include &lt;sha1.h&gt;
#include &lt;mysql.h&gt;

/* Setup for Ethernet Library */
byte mac_addr[] = { 0xC8, 0x0A, 0xA9, 0xAF, 0x83, 0x58 }; 
IPAddress server_addr(192,168,0,102);

/* Setup for the Connector/Arduino */
Connector my_conn; // The Connector/Arduino reference
char user[] = "root";
char password[] = "fifa2005";
char INSERT_SQL[] = "INSERT INTO test_arduino.hello VALUES ('Hello from Arduino!', NULL)";

void setup() {
Ethernet.begin(mac_addr);
Serial.begin(115200);
delay(1000);
Serial.println("Connecting...");
if (my_conn.mysql_connect(server_addr, 3306, user, password))
delay(500);
else
Serial.println("Connection failed.");
}

void loop() {
}


I have the following database:

mysql&gt; CREATE DATABASE test_arduino;
Query OK, 1 row affected (0.00 sec)
mysql&gt; USE test_arduino;
Database changed
mysql&gt; CREATE TABLE hello (source char(20), event_date timestamp);
Query OK, 0 rows affected (0.01 sec)


This is the output message: 

Connecting... Connection failed.


I am not sure this is the right IP address: 192,168,0,102. I tried with the localhost IP address - 127.0.0.1, but nothing happened.
First you have to grant permission to the user!

Type the query in MySQL like:



GRANT ALL ON test_arduino.* TO root@'192.168.0.102' IDENTIFIED BY 'fifa2005';