zim32 / mysql.dart

MySQL client for Dart written in Dart
BSD 3-Clause "New" or "Revised" License
64 stars 17 forks source link

I have TimeoutException error #39

Open Emirgms opened 1 year ago

Emirgms commented 1 year ago

Hi zim, Im using this package in localhost no problem but i need connect remote database i have this error,remote databe is phpmyadmin host and port are true but i cant connect i need your help pls

class MySql {
  Future<MySQLConnection> getConnection() async {
    debugPrint("Connecting to mysql server...");
    final conn = await MySQLConnection.createConnection(
        host: '185.106.208.225', port: 8880, userName: "admin", password: "password", secure: false);
    await conn.connect();
    debugPrint('bağlandı');
    return conn;
  }
}

I/flutter (12322): Connecting to mysql server... I/flutter (12322): ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── I/flutter (12322): │ #0 MySQLConnection.createConnection package:mysql_client/…/mysql_client/connection.dart:87 I/flutter (12322): │ #1 MySql.getConnection package:inncrea/data_helper/data_helper.dart:9 I/flutter (12322): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄ I/flutter (12322): │ 🐛 Establishing socket connection I/flutter (12322): └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── I/flutter (12322): ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── I/flutter (12322): │ #0 MySQLConnection.createConnection package:mysql_client/…/mysql_client/connection.dart:89 I/flutter (12322): │ #1 <asynchronous suspension> I/flutter (12322): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄ I/flutter (12322): │ 🐛 Socket connection established I/flutter (12322): └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── E/flutter (12322): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: TimeoutException after 0:00:05.000000: Future not completed E/flutter (12322):

Emirgms commented 1 year ago

i need example code.

http://185.106.208.225:8880 i have this adress but doesnt work im using 185.106.208.225 is it true ?

dukefirehawk commented 1 year ago
  1. Use MySQL Workbench to connect to the remote database to verify that connection is working
  2. If you are using MySQL 8, use secure:true as that is the default
  3. Set logger timeout, i.e.await conn.connect(timeoutMs:30000);
  4. Avoid connecting directly from Flutter to MySQL
zim32 commented 1 year ago

This is strange. I did not see any data coming to mysql client. After Socket connection established there should be message like

Processing socket data. Current state is _MySQLConnectionState.waitInitialHandshake It means library receives some data from socket.