Go Down

Topic: ESP8266/Wampserver-error in conenctivity (Read 143 times) previous topic - next topic

samerou

Hello ,

I'm trying to connect to WampServer(PhpMyAdmin)  in order to send some data but without success  .

I pinged my server PhpMyAdmin ( ping 127.0.0.1) and it's fine

also pinged my pc and it's fine  and my esp also fine  but I could find the problem why I cannot log to wamp server  using PORT 3306

The code is below

Code: [Select]
// Created by: Dr. Charles A. Bell

#include "ESP8266WiFi.h"
#include <MySQL_Connection.h>
#include <MySQL_Cursor.h>


IPAddress server_addr(127,0,0,1);  // IP of the MySQL *server* here
char user[] = "esp";              // MySQL user login username
char password[] = "";        // MySQL user login password

const char* SSID = "alpha";         // Your network SSID
const char* PASS = "beta";

// Sample query
char INSERT_SQL[] = "INSERT INTO sogecdb (user) VALUES ('Hello, Arduino!')";

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


void setup() {
  Serial.begin(115200);
  while (!Serial); // wait for serial port to connect

  Serial.print("Connecting to "+*SSID);
  WiFi.begin(SSID, PASS);
  Serial.println("going into wl connect");

  while (WiFi.status() != WL_CONNECTED) //not connected,  ...waiting to connect
    {
      delay(1000);
      Serial.print(".");
    }

  Serial.println("wl connected");
  Serial.println("");
  Serial.println("Credentials accepted! Connected to wifi\n ");
  Serial.println(WiFi.localIP());
  Serial.println("");


  if (conn.connect(server_addr, 3306, user, password)) {
    delay(1000);
  }
  else
    Serial.println("Connection failed.");
}


void loop() {
  delay(2000);

  Serial.println("Recording data.");

  // Initiate the query class instance
  MySQL_Cursor *cur_mem = new MySQL_Cursor(&conn);
  // Execute the query
  cur_mem->execute(INSERT_SQL);
  // Note: since there are no results, we do not need to read any data
  // Deleting the cursor also frees up memory used
  delete cur_mem;
}



and the error is below  :


Code: [Select]
13:59:53.616 -> d! Connected to wifi
13:59:53.616 ->  going into wl connect
13:59:54.619 -> ...wl connected
13:59:56.624 ->
13:59:56.624 -> Credentials accepted! Connected to wifi
13:59:56.624 -> 
13:59:56.624 -> 192.168.1.5
13:59:56.624 ->
14:00:20.637 -> Connection failed.
14:00:22.626 -> Recording data.
14:00:22.626 ->
14:00:22.626 -> Exception (3):
14:00:22.626 -> epc1=0x402059fe epc2=0x00000000 epc3=0x00000000 excvaddr=0x402381e4 depc=0x00000000
14:00:22.626 ->
14:00:22.626 -> ctx: cont
14:00:22.626 -> sp: 3ffefaa0 end: 3ffefcd0 offset: 01a0
14:00:22.626 ->
14:00:22.626 -> >>>stack>>>
14:00:22.626 -> 3ffefc40:  4020137a 00000001 3ffe8ba5 40205a08 
14:00:22.679 -> 3ffefc50:  3ffeead0 0000000e 3ffe893a 3ffeec9c 
14:00:22.679 -> 3ffefc60:  3fffdad0 00000000 3ffeec70 40205121 
14:00:22.679 -> 3ffefc70:  402381e4 00000000 3ffeec70 3ffeec9c 
14:00:22.679 -> 3ffefc80:  3fffdad0 00000000 3ffeec70 40205169 
14:00:22.679 -> 3ffefc90:  4020137a 00000000 3fff146c 402031a6 
14:00:22.679 -> 3ffefca0:  40107108 00000000 3fff146c 402021b2 
14:00:22.679 -> 3ffefcb0:  3fffdad0 00000000 3ffeec94 40205494 
14:00:22.679 -> 3ffefcc0:  feefeffe feefeffe 3ffeecb0 40100710 
14:00:22.679 -> <<<stack<<<
14:00:22.726 ->
14:00:22.726 ->  ets Jan  8 2013,rst cause:2, boot mode:(1,6)
14:00:22.726 ->
14:00:30.902 ->
14:00:30.902 ->  ets Jan  8 2013,rst cause:4, boot mode:(1,6)
14:00:30.902 ->
14:00:30.902 -> wdt reset


I tried a solution like creating new user and name it ESP and changing host name but no success

any guidnance please maybe I missing Something

Best Regards  ,

sterretje

127.0.0.1 is the local host; that's not the address of the PC that the WAMP server is running on.
If you understand an example, use it.
If you don't understand an example, don't use it.

Electronics engineer by trade, software engineer by profession. Trying to get back into electronics after 15 years absence.

samerou

thank you for your reply  ,


I did change the address from 127.0.0.1 to 192.168.1.5(PC)  But same thing :(

Go Up