mysql.dart
mysql.dart copied to clipboard
I have TimeoutException error
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):
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 ?
- Use MySQL Workbench to connect to the remote database to verify that connection is working
- If you are using MySQL 8, use
secure:true
as that is the default - Set logger timeout, i.e.
await conn.connect(timeoutMs:30000);
- Avoid connecting directly from Flutter to MySQL
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.