- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hi, i'm trying to run the basic example of the library but the Sketch stops in the line "if (conn.connect(server_addr, 3306, user, password))" .
I don't know what could be the problem.
this is the code
# include
# include
# include
IPAddress server_addr(192,168,1,100); // IP of the MySQL *server* here
char user[] = "cymo"; // MySQL user login username
char password[] = "cymo"; // MySQL user login password
// Sample query
char query[] = "SELECT * FROM cymo_db.login";
EthernetClient client;
MySQL_Connection conn((Client *)&client);
// Create an instance of the cursor passing in the connection
MySQL_Cursor cur = MySQL_Cursor(&conn);
void setup() {
Serial.begin(115200);
// eglibc ethernet naming...
system("ifconfig eth0 192.168.1.222 netmask 255.255.255.0");
Serial.println(Ethernet.localIP());
while (!Serial); // wait for serial port to connect
Serial.println("Connecting...");
if (conn.connect(server_addr, 3306, user, password)) {
delay(1000);
}
else
Serial.println("Connection failed.");
}
When I upload the sketch to the galileo and turn on the serial monitor i can see
192.168. 1.222
Connecting...
and nothing else of the sketch keeps running.
I don't know if this is the right place to ask for this, but in your Blog i couldn't do it.
Thanks.
Roberto
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hi Roberto,
I don't have any Galileo with MySQL at hand to try, but maybe you can check the following:
1) Why the difference among IPs?:
IPAddress server_addr(192,168,1,100); // IP of the MySQL *server* here
...
system("ifconfig eth0 192.168.1.222 netmask 255.255.255.0");
2) Do the MySQL console work fine?
3) Try with "localhost" instead of the "external" IP address
HTH,
Fernando.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Replying to myself just to note that if the MySQL server is not running in the Galileo, then it has to be configured to accept connections from remote hosts.
Fernando.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hi Roberto,
I would like to know if you have checked your network connection with MySQL server. Both, the Galileo and the MySQL server must be in the same network, and as Fernando said, you must setup the MySQL server to permit network connections, also be sure there are not firewalls or port blocking software to prohibit access to the server (MySQL default port is 3306). If you have another computer available, please use it instead Galileo to verify if your user account and permissions used in your sketch can connect to the database server.
Hope this information helps, let us know your results.
Regards,
-Yermi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hi Roberto,
I would like to know if try my previous suggestions, and also, if you need more help, please let me know.
Regards,
-Yermi

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page