-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stuck at Connecting to SQL .... #41
Comments
Did you modify the connect replacing Ethernet.h with the ESPWifi header
file!
…On Mon, Apr 16, 2018 at 10:04 testsubject ***@***.***> wrote:
when i try to start the code below my nodemcu can connect to network
already got IP and when it get into the connecting to sql the process just
stop. Can someone figure why ? ,im using xampp phpmyadmin as database
#include <ESP8266WiFi.h> // Use this for WiFi instead of Ethernet.h
#include <MySQL_Connection.h>
#include <MySQL_Cursor.h>
IPAddress server_addr(192, 168, 1, 100); // IP of the MySQL *server* here
char user[] = "root"; // MySQL user login username
char password[] = ""; // MySQL user login password
// Sample query
char INSERT_SQL[] = "INSERT INTO test_arduino.hello_arduino (message)
VALUES ('Hello, Arduino!')";
// WiFi card example
char ssid[] = "x"; // your SSID
char pass[] = "x"; // your SSID Password
WiFiClient client; // Use this for WiFi instead of EthernetClient
MySQL_Connection conn(&client);
MySQL_Cursor* cursor;
void setup()
{
Serial.begin(115200);
while (!Serial); // wait for serial port to connect. Needed for Leonardo
only
// Begin WiFi section
Serial.printf("\nConnecting to %s", ssid);
WiFi.begin(ssid, pass);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
// print out info about the connection:
Serial.println("\nConnected to network");
Serial.print("My IP address is: ");
Serial.println(WiFi.localIP());
Serial.print("Connecting to SQL... ");
if (conn.connect(server_addr, 3306, user, password))
Serial.println("OK.");
else
Serial.println("FAILED.");
// create MySQL cursor object
cursor = new MySQL_Cursor(&conn);
}
void loop()
{
if (conn.connected())
cursor->execute(INSERT_SQL);
delay(5000);
}
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#41>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AH0j4Oo3oj1yPEvz8VR21vAeLKBiM75Fks5tpKUIgaJpZM4TWllR>
.
|
XAMP uses MariaDB not original OracleMySQL, i have an similar issue, maybe this is the problem. |
Correct. The connectir does not work with anything other than Oracle’s
MySQL. Your only option is to uninstall the existing variant and install
MySQL. For best results, install MySQL 5.7. Version 8.0 will work but you
must enable the legacy password encryption.
…On Fri, May 4, 2018 at 18:11 squallus ***@***.***> wrote:
XAMP uses MariaDB not original OracleMySQL, i have an similar issue, maybe
this is the problem.
Lets hope there is an solution to this.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#41 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AH0j4PqD-M87F8dv_8np4ANAdKF2KggSks5tvNIugaJpZM4TWllR>
.
|
Had the same problem, it's permission issue. Added user permissions to mysql and it works now. |
Can we close this issue? |
@ChuckBell Can you maybe add support for MariaDB? Thanks! 😉 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
when i try to start the code below my nodemcu can connect to network already got IP and when it get into the connecting to sql the process just stop. Can someone figure why ? ,im using xampp phpmyadmin as database
#include <ESP8266WiFi.h> // Use this for WiFi instead of Ethernet.h
#include <MySQL_Connection.h>
#include <MySQL_Cursor.h>
IPAddress server_addr(192, 168, 1, 100); // IP of the MySQL server here
char user[] = "root"; // MySQL user login username
char password[] = ""; // MySQL user login password
// Sample query
char INSERT_SQL[] = "INSERT INTO test_arduino.hello_arduino (message) VALUES ('Hello, Arduino!')";
// WiFi card example
char ssid[] = "x"; // your SSID
char pass[] = "x"; // your SSID Password
WiFiClient client; // Use this for WiFi instead of EthernetClient
MySQL_Connection conn(&client);
MySQL_Cursor* cursor;
void setup()
{
Serial.begin(115200);
while (!Serial); // wait for serial port to connect. Needed for Leonardo only
// Begin WiFi section
Serial.printf("\nConnecting to %s", ssid);
WiFi.begin(ssid, pass);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
// print out info about the connection:
Serial.println("\nConnected to network");
Serial.print("My IP address is: ");
Serial.println(WiFi.localIP());
Serial.print("Connecting to SQL... ");
if (conn.connect(server_addr, 3306, user, password))
Serial.println("OK.");
else
Serial.println("FAILED.");
// create MySQL cursor object
cursor = new MySQL_Cursor(&conn);
}
void loop()
{
if (conn.connected())
cursor->execute(INSERT_SQL);
delay(5000);
}
The text was updated successfully, but these errors were encountered: