ChuckBell / MySQL_Connector_Arduino

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

Can not Connect to mySQL on Raspberry #42

Closed squallus closed 2 years ago

squallus commented 6 years ago

In my project i have an Raspberry Pi3 with Rasberian lite running, i have an LAMP server. now i´m trying to get my MCU Node to connect to this setup.

but.. the connection always fails.

heres my sketch:

#include <ESP8266WiFi.h>
#include <MySQL_Connection.h>
#include <MySQL_Cursor.h>
byte mac_addr[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0xED };
//
//
//SQL Daten
//
//
IPAddress server_addr(192,168,178, 45);  // IP of the MySQL *server* here
char user[] = "ccs";              // MySQL user login username
char password[] = "BC304Daedalus";        // MySQL user login password

//
//WiFi settings
//
const char ssid[] ="FRITZ!Box 4020 WE";
const char passwordw[] ="25021986";
IPAddress ip; 
WiFiClient client;
MySQL_Connection conn((Client *)&client);

void setup() {  // initialize digital pin 13 as an output.
 //
 //Serial einschalten
 //
 Serial.begin(9600) ;
 delay(100);
//
//WiFi Meldungen
//
Serial.print("Connect to ");
Serial.print(ssid);
WiFi.begin(ssid, passwordw);
while (WiFi.status() !=WL_CONNECTED){
  delay (500);
  Serial.print(".");
}
   Serial.println();
 Serial.println("Connected");
 IPAddress ip = WiFi.localIP();
    Serial.print("My IP address is: ");
    Serial.println(ip);
delay(20000);
     Serial.println("Connecting...");
  if (conn.connect(server_addr, 3306, user, password)) {
    delay(1000);
  }
  else
    Serial.println("Connection failed.");
  conn.close();

}// the loop function runs over and over again forever
void loop() {

}

Now, my mainquestion is: Rasperian uses as far as i know, MariaDB as mySql not the Original Oracle? can this be the problem, And, if so, is there a workaround?

ChuckBell commented 6 years ago

Sorry, and related issue #41.

On 5/4/18 6:04 PM, squallus wrote:

In my project i have an Raspberry Pi3 with Rasberian lite running, i have an LAMP server. now i´m trying to get my MCU Node to connect to this setup.

but.. the connection always fails.

heres my sketch:

`#include

include

include

byte mac_addr[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xBE, 0xED }; // // //SQL Daten // // IPAddress server_addr(192,168,178, 45); // IP of the MySQL /server/ here char user[] = "ccs"; // MySQL user login username char password[] = "BC304Daedalus"; // MySQL user login password

// //WiFi settings // const char ssid[] ="FRITZ!Box 4020 WE"; const char passwordw[] ="25021986"; IPAddress ip; WiFiClient client; MySQL_Connection conn((Client *)&client);

void setup() { // initialize digital pin 13 as an output. // //Serial einschalten // Serial.begin(9600) ; delay(100); // //WiFi Meldungen // Serial.print("Connect to "); Serial.print(ssid); WiFi.begin(ssid, passwordw); while (WiFi.status() !=WL_CONNECTED){ delay (500); Serial.print("."); } Serial.println(); Serial.println("Connected"); IPAddress ip = WiFi.localIP(); Serial.print("My IP address is: "); Serial.println(ip); delay(20000); Serial.println("Connecting..."); if (conn.connect(server_addr, 3306, user, password)) { delay(1000); } else Serial.println("Connection failed."); conn.close();

}// the loop function runs over and over again forever void loop() {

}`

Now, my mainquestion is: Rasperian uses as far as i know, MariaDB as mySql not the Original Oracle? And, if so, is there a workaround?

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

StoneAgeSkillz commented 6 years ago

Had same connection problems on my RasPi with MariaDB. Added user permissions and everything works now.

ChuckBell commented 5 years ago

Can we close this issue?