execution problem with mysql connector/arduino

hey,
we have a slight problem in connecting with the mysql database.

here is our code:
#include "SPI.h"
#include "Ethernet.h"
#include "mysql.h"
#include "sha1.h"
byte mac_addr[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

IPAddress server_addr(172,12,137,22);//ip address of the laptop and not the sql server
Connector my_conn;
char user[] = "root";
char password[] = "pass";

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

void loop()
{
}

we are getting the message
Connecting
and after a long time it shows connection failed.

we have installed libraries from MySQL Connector/Arduino in Launchpad

it shows no compilation error.

please suggest us some solution.

I've just altered the formatting of your code to make it more readable.
You have got as far as testing your access to the mysql server using the command (or similar) suggested in chapter 'Test Access' of the library reference manual ?:

mysql -ubob -psecret –h192.168.0.2 --port=3306
#include "SPI.h"
#include "Ethernet.h"
#include "mysql.h"
#include "sha1.h"
byte mac_addr[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

IPAddress server_addr(172, 12, 137, 22); //ip address of the laptop and not the sql server
Connector my_conn;
char user[] = "root";
char password[] = "pass";

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

void loop()
{
}

hi,
we have tried what you suggested.it is still not working right.
we executed mysql -ubob -psecret -h192.168.0.2 --port=3306 in cmd
it just showed
->

so we are not sure if it worked or not.

we only get the message connecting and after a long pause connection failed is displayed.
once we even gor sql error 1045 as well.

please tell us what else we can possibly do.we are trying to modify firewall settings also although we think that might not be the major problem here.

thanks

I guess that if you get through to a mySQL command line, you'll be able to issue commands on it like:

show tables;

and get answers. The address 192.168.0.2 in your command is the address of the mySQL server ?

Then, what is this address taken from your original code ?

IPAddress server_addr(172, 12, 137, 22); //ip address of the laptop and not the sql server

This document, which has a basic configuration guide, might help you: link

Hey you need to create a user in MySQL in this form:
CREATE USER BOB@'192.168.1.%'

and GRANT all priviliges to BOB@'192.168.1.%'