ChuckBell / MySQL_Connector_Arduino

Database connector library for using MySQL with your Arduino projects.
332 stars 133 forks source link

Arduino Nano ESP S3 can not connect to MySQL Server ' user: 'unauthenticated' #219

Open jonesek opened 6 months ago

jonesek commented 6 months ago

Greetings to all, specialy to Dr. Chuck Bell.

first of all Thank You for this connector. It helps me a lot in many home usecases.

I have problem with Arduino Nano ESP and only with this type. On others (Wifi Rev2, Iot 33) it works without any problem. During try to connect to MySQL it get stuck. ( pics1) . after 12 hours of trying i give up :)

on MySQL server i have error says "[Warning] Aborted connection 6 to db: 'unconnected' user: 'unauthenticated' host: '10.1.4.5' (This connection closed normally without authentication)" others non ESP arduino borads works perfectly.

on Serial monitor i see this : pic1

notes:

Thank You in advance. Pavel

include

include

include

include

include

include

include

include

//#include

include

// pin, for sensor

define pin 5

OneWire oneWire(pin); //onewire do Dallasu DallasTemperature sensors(&oneWire);

char INSERT_DATA1[] = "INSERT INTO data_zarizeni.udirna (TeplotaDoleLeva,TeplotaDolePrava,TeplotaHorniLeva,TeplotaHorniPrava,time) VALUES (%f,%f,%f,%f,now())"; char query[1024];

float TeplotaDoleLevaInt = 0; float TeplotaDolePravaInt = 0; float TeplotaHorniLevaInt = 0; float TeplotaHorniPravaInt = 0;

//SQL sekce IPAddress server_addr(10, 1, 2, 6); // IP of the MySQL server here char usr[] = "username"; // MySQL user login username - TAB MySQL.h char pwd[] = "passwd"; // MySQL user login password

WiFiClient client; MySQL_Connection conn((Client *)&client);

// wifi char ssid[] = "iot"; // your network SSID (name) char pass[] = "Passwd"; // your network password int status = WL_IDLE_STATUS; // the Wifi radio's status

void setup() { Serial.begin(9600); sensors.begin(); delay(2000); Serial.println("Start in 3...2....1..."); delay(500); WiFi.mode(WIFI_STA); WiFi.begin(ssid, pass);

while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); }

Serial.println(""); Serial.println("WiFi connected"); Serial.println("IP address: "); Serial.println(WiFi.localIP()); Serial.print(" Gateway: "); Serial.println(WiFi.gatewayIP());

const IPAddress remote_ip(10, 1, 2, 6); Serial.print(remote_ip); if (Ping.ping(remote_ip) > 0) { Serial.printf(" response time : %d/%.2f/%d ms\n", Ping.minTime(), Ping.averageTime(), Ping.maxTime()); } else { Serial.println(" Error !"); } }

void loop() {

for (int index = 0; index < 4; index++) { sensors.requestTemperatures(); Serial.print("Teplota je: "); Serial.print(sensors.getTempCByIndex(index)); //0 je index toho čidla Serial.println(" stupnu Celsia"); switch (index) { case 0: TeplotaDoleLevaInt = sensors.getTempCByIndex(index); case 1: TeplotaDolePravaInt = sensors.getTempCByIndex(index); case 2: TeplotaHorniLevaInt = sensors.getTempCByIndex(index); case 3: TeplotaHorniPravaInt = sensors.getTempCByIndex(index); } delay(200); }

delay(1000);

// vlozeni teplot Serial.println("Connecting..."); if (conn.connect(server_addr, 3307, usr, pwd)) { // Initiate the query class instance delay(1000); Serial.println("pripojen?"); MySQL_Cursor *cur_mem = new MySQL_Cursor(&conn); // Save sprintf(query, INSERT_DATA1, TeplotaDoleLevaInt, TeplotaDolePravaInt, TeplotaHorniLevaInt, TeplotaHorniPravaInt); // Execute the query cur_mem->execute(query); // Deleting the cursor also frees up memory used delete cur_mem; Serial.println("Data recorded."); } delay(30000); }

ChuckBell commented 6 months ago

The first thing I see is you are using port 3307. MySQL uses ports 3306 and 33060. So, unless you have configured your MySQL server to use 3307, this code will not connect over port 3307.

On Dec 30, 2023, at 6:15 AM, jonesek @.***> wrote:

Greetings to all, specialy to Dr. Chuck Bell.

first of all Thak You for tis connector. It helps me a lot in many home usecases.

I have problem with Arduino Nano ESP and only with this type. On others (Wifi Rev2, Iot 33) it works without any problem. During try to connect to MySQL it get stuck. ( pics1) . after 12 hours of trying i give up :)

on MySQL server i have error says "[Warning] Aborted connection 6 to db: 'unconnected' user: 'unauthenticated' host: '10.1.4.5' (This connection closed normally without authentication)" others non ESP arduino borads works perfectly.

on Serial monitor i see this : pic1.png (view on web) https://github.com/ChuckBell/MySQL_Connector_Arduino/assets/44143932/091b0c6a-0c34-4dea-9ff5-6ec2a123188c notes:

temperature is wrong because sensor is disconnected. tested with simple connection to wifi and then connect to MySQL Thank You in advance. Pavel

include

include

include

include

include

include

include

include

//#include

include

// pin, for sensor

define pin 5

OneWire oneWire(pin); //onewire do Dallasu DallasTemperature sensors(&oneWire);

char INSERT_DATA1[] = "INSERT INTO data_zarizeni.udirna (TeplotaDoleLeva,TeplotaDolePrava,TeplotaHorniLeva,TeplotaHorniPrava,time) VALUES (%f,%f,%f,%f,now())"; char query[1024];

float TeplotaDoleLevaInt = 0; float TeplotaDolePravaInt = 0; float TeplotaHorniLevaInt = 0; float TeplotaHorniPravaInt = 0;

//SQL sekce IPAddress server_addr(10, 1, 2, 6); // IP of the MySQL server here char usr[] = "username"; // MySQL user login username - TAB MySQL.h char pwd[] = "passwd"; // MySQL user login password

WiFiClient client; MySQL_Connection conn((Client *)&client);

// wifi char ssid[] = "iot"; // your network SSID (name) char pass[] = "Passwd"; // your network password int status = WL_IDLE_STATUS; // the Wifi radio's status

void setup() { Serial.begin(9600); sensors.begin(); delay(2000); Serial.println("Start in 3...2....1..."); delay(500); WiFi.mode(WIFI_STA); WiFi.begin(ssid, pass);

while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); }

Serial.println(""); Serial.println("WiFi connected"); Serial.println("IP address: "); Serial.println(WiFi.localIP()); Serial.print(" Gateway: "); Serial.println(WiFi.gatewayIP());

const IPAddress remote_ip(10, 1, 2, 6); Serial.print(remote_ip); if (Ping.ping(remote_ip) > 0) { Serial.printf(" response time : %d/%.2f/%d ms\n", Ping.minTime(), Ping.averageTime(), Ping.maxTime()); } else { Serial.println(" Error !"); } }

void loop() {

for (int index = 0; index < 4; index++) { sensors.requestTemperatures(); Serial.print("Teplota je: "); Serial.print(sensors.getTempCByIndex(index)); //0 je index toho čidla Serial.println(" stupnu Celsia"); switch (index) { case 0: TeplotaDoleLevaInt = sensors.getTempCByIndex(index); case 1: TeplotaDolePravaInt = sensors.getTempCByIndex(index); case 2: TeplotaHorniLevaInt = sensors.getTempCByIndex(index); case 3: TeplotaHorniPravaInt = sensors.getTempCByIndex(index); } delay(200); }

delay(1000);

// vlozeni teplot Serial.println("Connecting..."); if (conn.connect(server_addr, 3307, usr, pwd)) { // Initiate the query class instance delay(1000); Serial.println("pripojen?"); MySQL_Cursor *cur_mem = new MySQL_Cursor(&conn); // Save sprintf(query, INSERT_DATA1, TeplotaDoleLevaInt, TeplotaDolePravaInt, TeplotaHorniLevaInt, TeplotaHorniPravaInt); // Execute the query cur_mem->execute(query); // Deleting the cursor also frees up memory used delete cur_mem; Serial.println("Data recorded."); } delay(30000); }

— Reply to this email directly, view it on GitHub https://github.com/ChuckBell/MySQL_Connector_Arduino/issues/219, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB6SHYFNELFE2ICUSWA6TT3YL7ZVVAVCNFSM6AAAAABBHOOOQ2VHI2DSMVQWIX3LMV43ASLTON2WKOZSGA3DANZRG4YDIOA. You are receiving this because you are subscribed to this thread.

jonesek commented 6 months ago

The first thing I see is you are using port 3307. MySQL uses ports 3306 and 33060. So, unless you have configured your MySQL server to use 3307, this code will not connect over port 3307. On Dec 30, 2023, at 6:15 AM, jonesek @.**> wrote: Greetings to all, specialy to Dr. Chuck Bell. first of all Thak You for tis connector. It helps me a lot in many home usecases. I have problem with Arduino Nano ESP and only with this type. On others (Wifi Rev2, Iot 33) it works without any problem. During try to connect to MySQL it get stuck. ( pics1) . after 12 hours of trying i give up :) on MySQL server i have error says "[Warning] Aborted connection 6 to db: 'unconnected' user: 'unauthenticated' host: '10.1.4.5' (This connection closed normally without authentication)" others non ESP arduino borads works perfectly. on Serial monitor i see this : pic1.png (view on web) https://github.com/ChuckBell/MySQL_Connector_Arduino/assets/44143932/091b0c6a-0c34-4dea-9ff5-6ec2a123188c notes: temperature is wrong because sensor is disconnected. tested with simple connection to wifi and then connect to MySQL Thank You in advance. Pavel #include #include #include #include #include #include #include #include //#include #include // pin, for sensor #define pin 5 OneWire oneWire(pin); //onewire do Dallasu DallasTemperature sensors(&oneWire); char INSERT_DATA1[] = "INSERT INTO data_zarizeni.udirna (TeplotaDoleLeva,TeplotaDolePrava,TeplotaHorniLeva,TeplotaHorniPrava,time) VALUES (%f,%f,%f,%f,now())"; char query[1024]; float TeplotaDoleLevaInt = 0; float TeplotaDolePravaInt = 0; float TeplotaHorniLevaInt = 0; float TeplotaHorniPravaInt = 0; //SQL sekce IPAddress server_addr(10, 1, 2, 6); // IP of the MySQL server here char usr[] = "username"; // MySQL user login username - TAB MySQL.h char pwd[] = "passwd"; // MySQL user login password WiFiClient client; MySQL_Connection conn((Client )&client); // wifi char ssid[] = "iot"; // your network SSID (name) char pass[] = "Passwd"; // your network password int status = WL_IDLE_STATUS; // the Wifi radio's status void setup() { Serial.begin(9600); sensors.begin(); delay(2000); Serial.println("Start in 3...2....1..."); delay(500); WiFi.mode(WIFI_STA); WiFi.begin(ssid, pass); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println(""); Serial.println("WiFi connected"); Serial.println("IP address: "); Serial.println(WiFi.localIP()); Serial.print(" Gateway: "); Serial.println(WiFi.gatewayIP()); const IPAddress remote_ip(10, 1, 2, 6); Serial.print(remote_ip); if (Ping.ping(remote_ip) > 0) { Serial.printf(" response time : %d/%.2f/%d ms\n", Ping.minTime(), Ping.averageTime(), Ping.maxTime()); } else { Serial.println(" Error !"); } } void loop() { for (int index = 0; index < 4; index++) { sensors.requestTemperatures(); Serial.print("Teplota je: "); Serial.print(sensors.getTempCByIndex(index)); //0 je index toho čidla Serial.println(" stupnu Celsia"); switch (index) { case 0: TeplotaDoleLevaInt = sensors.getTempCByIndex(index); case 1: TeplotaDolePravaInt = sensors.getTempCByIndex(index); case 2: TeplotaHorniLevaInt = sensors.getTempCByIndex(index); case 3: TeplotaHorniPravaInt = sensors.getTempCByIndex(index); } delay(200); } delay(1000); // vlozeni teplot Serial.println("Connecting..."); if (conn.connect(server_addr, 3307, usr, pwd)) { // Initiate the query class instance delay(1000); Serial.println("pripojen?"); MySQL_Cursor *cur_mem = new MySQL_Cursor(&conn); // Save sprintf(query, INSERT_DATA1, TeplotaDoleLevaInt, TeplotaDolePravaInt, TeplotaHorniLevaInt, TeplotaHorniPravaInt); // Execute the query cur_mem->execute(query); // Deleting the cursor also frees up memory used delete cur_mem; Serial.println("Data recorded."); } delay(30000); } — Reply to this email directly, view it on GitHub <#219>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB6SHYFNELFE2ICUSWA6TT3YL7ZVVAVCNFSM6AAAAABBHOOOQ2VHI2DSMVQWIX3LMV43ASLTON2WKOZSGA3DANZRG4YDIOA. You are receiving this because you are subscribed to this thread.

Yes, thats correct . my mysql is listening on 3307 Pavel

ChuckBell commented 6 months ago

Can other IoT devices connect to the same MySQL server with the same user id and password? I’d check that first.

On Jan 2, 2024, at 11:28 AM, jonesek @.***> wrote:

The first thing I see is you are using port 3307. MySQL uses ports 3306 and 33060. So, unless you have configured your MySQL server to use 3307, this code will not connect over port 3307. … <x-msg://2/#> On Dec 30, 2023, at 6:15 AM, jonesek @.**> wrote: Greetings to all, specialy to Dr. Chuck Bell. first of all Thak You for tis connector. It helps me a lot in many home usecases. I have problem with Arduino Nano ESP and only with this type. On others (Wifi Rev2, Iot 33) it works without any problem. During try to connect to MySQL it get stuck. ( pics1) . after 12 hours of trying i give up :) on MySQL server i have error says "[Warning] Aborted connection 6 to db: 'unconnected' user: 'unauthenticated' host: '10.1.4.5' (This connection closed normally without authentication)" others non ESP arduino borads works perfectly. on Serial monitor i see this : pic1.png (view on web) https://github.com/ChuckBell/MySQL_Connector_Arduino/assets/44143932/091b0c6a-0c34-4dea-9ff5-6ec2a123188c notes: temperature is wrong because sensor is disconnected. tested with simple connection to wifi and then connect to MySQL Thank You in advance. Pavel #include #include #include #include #include #include #include #include //#include #include // pin, for sensor #define pin 5 OneWire oneWire(pin); //onewire do Dallasu DallasTemperature sensors(&oneWire); char INSERT_DATA1[] = "INSERT INTO data_zarizeni.udirna (TeplotaDoleLeva,TeplotaDolePrava,TeplotaHorniLeva,TeplotaHorniPrava,time) VALUES (%f,%f,%f,%f,now())"; char query[1024]; float TeplotaDoleLevaInt = 0; float TeplotaDolePravaInt = 0; float TeplotaHorniLevaInt = 0; float TeplotaHorniPravaInt = 0; //SQL sekce IPAddress server_addr(10, 1, 2, 6); // IP of the MySQL server here char usr[] = "username"; // MySQL user login username - TAB MySQL.h char pwd[] = "passwd"; // MySQL user login password WiFiClient client; MySQL_Connection conn((Client )&client); // wifi char ssid[] = "iot"; // your network SSID (name) char pass[] = "Passwd"; // your network password int status = WL_IDLE_STATUS; // the Wifi radio's status void setup() { Serial.begin(9600); sensors.begin(); delay(2000); Serial.println("Start in 3...2....1..."); delay(500); WiFi.mode(WIFI_STA); WiFi.begin(ssid, pass); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println(""); Serial.println("WiFi connected"); Serial.println("IP address: "); Serial.println(WiFi.localIP()); Serial.print(" Gateway: "); Serial.println(WiFi.gatewayIP()); const IPAddress remote_ip(10, 1, 2, 6); Serial.print(remote_ip); if (Ping.ping(remote_ip) > 0) { Serial.printf(" response time : %d/%.2f/%d ms\n", Ping.minTime(), Ping.averageTime(), Ping.maxTime()); } else { Serial.println(" Error !"); } } void loop() { for (int index = 0; index < 4; index++) { sensors.requestTemperatures(); Serial.print("Teplota je: "); Serial.print(sensors.getTempCByIndex(index)); //0 je index toho čidla Serial.println(" stupnu Celsia"); switch (index) { case 0: TeplotaDoleLevaInt = sensors.getTempCByIndex(index); case 1: TeplotaDolePravaInt = sensors.getTempCByIndex(index); case 2: TeplotaHorniLevaInt = sensors.getTempCByIndex(index); case 3: TeplotaHorniPravaInt = sensors.getTempCByIndex(index); } delay(200); } delay(1000); // vlozeni teplot Serial.println("Connecting..."); if (conn.connect(server_addr, 3307, usr, pwd)) { // Initiate the query class instance delay(1000); Serial.println("pripojen?"); MySQL_Cursor *cur_mem = new MySQL_Cursor(&conn); // Save sprintf(query, INSERT_DATA1, TeplotaDoleLevaInt, TeplotaDolePravaInt, TeplotaHorniLevaInt, TeplotaHorniPravaInt); // Execute the query cur_mem->execute(query); // Deleting the cursor also frees up memory used delete cur_mem; Serial.println("Data recorded."); } delay(30000); } — Reply to this email directly, view it on GitHub <#219 https://github.com/ChuckBell/MySQL_Connector_Arduino/issues/219>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB6SHYFNELFE2ICUSWA6TT3YL7ZVVAVCNFSM6AAAAABBHOOOQ2VHI2DSMVQWIX3LMV43ASLTON2WKOZSGA3DANZRG4YDIOA. You are receiving this because you are subscribed to this thread.

Yes, thats correct . my mysql is listening on 3307 Pavel

— Reply to this email directly, view it on GitHub https://github.com/ChuckBell/MySQL_Connector_Arduino/issues/219#issuecomment-1874251365, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB6SHYCQZBCPL67OS3VZ4Q3YMQYSDAVCNFSM6AAAAABBHOOOQ2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZUGI2TCMZWGU. You are receiving this because you commented.

jonesek commented 6 months ago

Can other IoT devices connect to the same MySQL server with the same user id and password? I’d check that first. On Jan 2, 2024, at 11:28 AM, jonesek @.> wrote: The first thing I see is you are using port 3307. MySQL uses ports 3306 and 33060. So, unless you have configured your MySQL server to use 3307, this code will not connect over port 3307. … <x-msg://2/#> On Dec 30, 2023, at 6:15 AM, jonesek @.> wrote: Greetings to all, specialy to Dr. Chuck Bell. first of all Thak You for tis connector. It helps me a lot in many home usecases. I have problem with Arduino Nano ESP and only with this type. On others (Wifi Rev2, Iot 33) it works without any problem. During try to connect to MySQL it get stuck. ( pics1) . after 12 hours of trying i give up :) on MySQL server i have error says "[Warning] Aborted connection 6 to db: 'unconnected' user: 'unauthenticated' host: '10.1.4.5' (This connection closed normally without authentication)" others non ESP arduino borads works perfectly. on Serial monitor i see this : pic1.png (view on web) https://github.com/ChuckBell/MySQL_Connector_Arduino/assets/44143932/091b0c6a-0c34-4dea-9ff5-6ec2a123188c notes: temperature is wrong because sensor is disconnected. tested with simple connection to wifi and then connect to MySQL Thank You in advance. Pavel #include #include #include #include #include #include #include #include //#include #include // pin, for sensor #define pin 5 OneWire oneWire(pin); //onewire do Dallasu DallasTemperature sensors(&oneWire); char INSERT_DATA1[] = "INSERT INTO data_zarizeni.udirna (TeplotaDoleLeva,TeplotaDolePrava,TeplotaHorniLeva,TeplotaHorniPrava,time) VALUES (%f,%f,%f,%f,now())"; char query[1024]; float TeplotaDoleLevaInt = 0; float TeplotaDolePravaInt = 0; float TeplotaHorniLevaInt = 0; float TeplotaHorniPravaInt = 0; //SQL sekce IPAddress server_addr(10, 1, 2, 6); // IP of the MySQL server here char usr[] = "username"; // MySQL user login username - TAB MySQL.h char pwd[] = "passwd"; // MySQL user login password WiFiClient client; MySQL_Connection conn((Client )&client); // wifi char ssid[] = "iot"; // your network SSID (name) char pass[] = "Passwd"; // your network password int status = WL_IDLE_STATUS; // the Wifi radio's status void setup() { Serial.begin(9600); sensors.begin(); delay(2000); Serial.println("Start in 3...2....1..."); delay(500); WiFi.mode(WIFI_STA); WiFi.begin(ssid, pass); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println(""); Serial.println("WiFi connected"); Serial.println("IP address: "); Serial.println(WiFi.localIP()); Serial.print(" Gateway: "); Serial.println(WiFi.gatewayIP()); const IPAddress remote_ip(10, 1, 2, 6); Serial.print(remote_ip); if (Ping.ping(remote_ip) > 0) { Serial.printf(" response time : %d/%.2f/%d ms\n", Ping.minTime(), Ping.averageTime(), Ping.maxTime()); } else { Serial.println(" Error !"); } } void loop() { for (int index = 0; index < 4; index++) { sensors.requestTemperatures(); Serial.print("Teplota je: "); Serial.print(sensors.getTempCByIndex(index)); //0 je index toho čidla Serial.println(" stupnu Celsia"); switch (index) { case 0: TeplotaDoleLevaInt = sensors.getTempCByIndex(index); case 1: TeplotaDolePravaInt = sensors.getTempCByIndex(index); case 2: TeplotaHorniLevaInt = sensors.getTempCByIndex(index); case 3: TeplotaHorniPravaInt = sensors.getTempCByIndex(index); } delay(200); } delay(1000); // vlozeni teplot Serial.println("Connecting..."); if (conn.connect(server_addr, 3307, usr, pwd)) { // Initiate the query class instance delay(1000); Serial.println("pripojen?"); MySQL_Cursor cur_mem = new MySQL_Cursor(&conn); // Save sprintf(query, INSERT_DATA1, TeplotaDoleLevaInt, TeplotaDolePravaInt, TeplotaHorniLevaInt, TeplotaHorniPravaInt); // Execute the query cur_mem->execute(query); // Deleting the cursor also frees up memory used delete cur_mem; Serial.println("Data recorded."); } delay(30000); } — Reply to this email directly, view it on GitHub <#219 <#219>>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB6SHYFNELFE2ICUSWA6TT3YL7ZVVAVCNFSM6AAAAABBHOOOQ2VHI2DSMVQWIX3LMV43ASLTON2WKOZSGA3DANZRG4YDIOA. You are receiving this because you are subscribed to this thread. Yes, thats correct . my mysql is listening on 3307 Pavel — Reply to this email directly, view it on GitHub <#219 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB6SHYCQZBCPL67OS3VZ4Q3YMQYSDAVCNFSM6AAAAABBHOOOQ2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZUGI2TCMZWGU. You are receiving this because you commented.

Yes, correct , other connections from other platforms with same password and username are fine.

ChuckBell commented 6 months ago

I wonder…what version of the ESP library are you using? Can you try to downgrade and see if that helps?

On Jan 2, 2024, at 12:05 PM, jonesek @.***> wrote:

Can other IoT devices connect to the same MySQL server with the same user id and password? I’d check that first. … <x-msg://3/#> On Jan 2, 2024, at 11:28 AM, jonesek @.> wrote: The first thing I see is you are using port 3307. MySQL uses ports 3306 and 33060. So, unless you have configured your MySQL server to use 3307, this code will not connect over port 3307. … x-msg://2/# On Dec 30, 2023, at 6:15 AM, jonesek @.> wrote: Greetings to all, specialy to Dr. Chuck Bell. first of all Thak You for tis connector. It helps me a lot in many home usecases. I have problem with Arduino Nano ESP and only with this type. On others (Wifi Rev2, Iot 33) it works without any problem. During try to connect to MySQL it get stuck. ( pics1) . after 12 hours of trying i give up :) on MySQL server i have error says "[Warning] Aborted connection 6 to db: 'unconnected' user: 'unauthenticated' host: '10.1.4.5' (This connection closed normally without authentication)" others non ESP arduino borads works perfectly. on Serial monitor i see this : pic1.png (view on web) https://github.com/ChuckBell/MySQL_Connector_Arduino/assets/44143932/091b0c6a-0c34-4dea-9ff5-6ec2a123188c notes: temperature is wrong because sensor is disconnected. tested with simple connection to wifi and then connect to MySQL Thank You in advance. Pavel #include #include #include #include #include #include #include #include //#include #include // pin, for sensor #define pin 5 OneWire oneWire(pin); //onewire do Dallasu DallasTemperature sensors(&oneWire); char INSERT_DATA1[] = "INSERT INTO data_zarizeni.udirna (TeplotaDoleLeva,TeplotaDolePrava,TeplotaHorniLeva,TeplotaHorniPrava,time) VALUES (%f,%f,%f,%f,now())"; char query[1024]; float TeplotaDoleLevaInt = 0; float TeplotaDolePravaInt = 0; float TeplotaHorniLevaInt = 0; float TeplotaHorniPravaInt = 0; //SQL sekce IPAddress server_addr(10, 1, 2, 6); // IP of the MySQL server here char usr[] = "username"; // MySQL user login username - TAB MySQL.h char pwd[] = "passwd"; // MySQL user login password WiFiClient client; MySQL_Connection conn((Client )&client); // wifi char ssid[] = "iot"; // your network SSID (name) char pass[] = "Passwd"; // your network password int status = WL_IDLE_STATUS; // the Wifi radio's status void setup() { Serial.begin(9600); sensors.begin(); delay(2000); Serial.println("Start in 3...2....1..."); delay(500); WiFi.mode(WIFI_STA); WiFi.begin(ssid, pass); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println(""); Serial.println("WiFi connected"); Serial.println("IP address: "); Serial.println(WiFi.localIP()); Serial.print(" Gateway: "); Serial.println(WiFi.gatewayIP()); const IPAddress remote_ip(10, 1, 2, 6); Serial.print(remote_ip); if (Ping.ping(remote_ip) > 0) { Serial.printf(" response time : %d/%.2f/%d ms\n", Ping.minTime(), Ping.averageTime(), Ping.maxTime()); } else { Serial.println(" Error !"); } } void loop() { for (int index = 0; index < 4; index++) { sensors.requestTemperatures(); Serial.print("Teplota je: "); Serial.print(sensors.getTempCByIndex(index)); //0 je index toho čidla Serial.println(" stupnu Celsia"); switch (index) { case 0: TeplotaDoleLevaInt = sensors.getTempCByIndex(index); case 1: TeplotaDolePravaInt = sensors.getTempCByIndex(index); case 2: TeplotaHorniLevaInt = sensors.getTempCByIndex(index); case 3: TeplotaHorniPravaInt = sensors.getTempCByIndex(index); } delay(200); } delay(1000); // vlozeni teplot Serial.println("Connecting..."); if (conn.connect(server_addr, 3307, usr, pwd)) { // Initiate the query class instance delay(1000); Serial.println("pripojen?"); MySQL_Cursor cur_mem = new MySQL_Cursor(&conn); // Save sprintf(query, INSERT_DATA1, TeplotaDoleLevaInt, TeplotaDolePravaInt, TeplotaHorniLevaInt, TeplotaHorniPravaInt); // Execute the query cur_mem->execute(query); // Deleting the cursor also frees up memory used delete cur_mem; Serial.println("Data recorded."); } delay(30000); } — Reply to this email directly, view it on GitHub <#219 https://github.com/ChuckBell/MySQL_Connector_Arduino/issues/219 <#219 https://github.com/ChuckBell/MySQL_Connector_Arduino/issues/219>>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB6SHYFNELFE2ICUSWA6TT3YL7ZVVAVCNFSM6AAAAABBHOOOQ2VHI2DSMVQWIX3LMV43ASLTON2WKOZSGA3DANZRG4YDIOA. You are receiving this because you are subscribed to this thread. Yes, thats correct . my mysql is listening on 3307 Pavel — Reply to this email directly, view it on GitHub <#219 (comment) https://github.com/ChuckBell/MySQL_Connector_Arduino/issues/219#issuecomment-1874251365>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB6SHYCQZBCPL67OS3VZ4Q3YMQYSDAVCNFSM6AAAAABBHOOOQ2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZUGI2TCMZWGU. You are receiving this because you commented.

Yes, correct , other connections from other platforms with same password and username are fine.

— Reply to this email directly, view it on GitHub https://github.com/ChuckBell/MySQL_Connector_Arduino/issues/219#issuecomment-1874297850, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB6SHYCT4CPIJMB2L4F25VDYMQ44RAVCNFSM6AAAAABBHOOOQ2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZUGI4TOOBVGA. You are receiving this because you commented.

jonesek commented 5 months ago

I use no special library, once i have added library for ESP nano it should be fine. image

Pavel

ChuckBell commented 5 months ago

Indeed. Precisely that page. Choose a lower version (2.0.10 for example) and try with that version.

On Jan 9, 2024, at 8:09 AM, jonesek @.***> wrote:

I use no special library, once i have added library for ESP nano it should be fine. image.png (view on web) https://github.com/ChuckBell/MySQL_Connector_Arduino/assets/44143932/bfa017a6-0fc1-47f2-adca-606b0931ec81 Pavel

— Reply to this email directly, view it on GitHub https://github.com/ChuckBell/MySQL_Connector_Arduino/issues/219#issuecomment-1883034324, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB6SHYEZ2MAG552IKEDTQ2LYNU6PZAVCNFSM6AAAAABBHOOOQ2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBTGAZTIMZSGQ. You are receiving this because you commented.