zim32 / mysql.dart

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

Connection timed out (OS Error: Connection timed out, errno = 110), address = 10.0.0.2, port = 38528) or/and Connection refused (OS Error: Connection refused, errno = 111), address = 127.0.0.1, port = 39328) #30

Closed Emirgms closed 2 years ago

Emirgms commented 2 years ago

hi my app did work lasterday morning but evening didnt work i didnt change code

this code lasterday did work but today or lasterday evening didnt work . im taking connection timeout error class MySql { Future getConnection() async { debugPrint("Connecting to mysql server...");

// create connection
final conn = await MySQLConnection.createConnection(
    host: "10.0.0.2",
    port: 3306,
    userName: "root",
    password: "*******",
    secure: false
    // optional
    );
debugPrint(conn.connected.toString());
await conn.connect();
debugPrint('conneccted');
return conn;

} },,

another error . host: "127.0.0.1" connection refused error

Emirgms commented 2 years ago

Restarted application in 884ms. I/flutter (10318): Connecting to mysql server... I/flutter (10318): ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── I/flutter (10318): │ #0 MySQLConnection.createConnection I/flutter (10318): │ #1 MySql.getConnection I/flutter (10318): ├┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄ I/flutter (10318): │ 🐛 Establishing socket connection I/flutter (10318): └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── all log is here

zim32 commented 2 years ago

If you are in Windows and your app is flutter, try to connect to mysql through console, using mysql client anf then check again.

Emirgms commented 2 years ago

i dont know how i can console using mysql client

zim32 commented 2 years ago

This connection refused comes from OS. There is nothing I can do here

Emirgms commented 2 years ago

but this did work lasterday i just push github and its didnt work

zim32 commented 2 years ago

I don't know your setup. F.e. example I don't know why port number is 39328, not 3306

Emirgms commented 2 years ago

i need help. i need this packet.

Emirgms commented 2 years ago

i did try another pc but its simple error

zim32 commented 2 years ago

Where you are connecting from? Where is dart code? And where is mysql server?

Emirgms commented 2 years ago

what ? im working localhost. lasterday you did new patch and i have taking error me and other pc

MHShetty commented 2 years ago

@Emirgms On which platform are you running your Flutter app on?

Emirgms commented 2 years ago

android. my emulator is pixel 3a

MHShetty commented 2 years ago

You might want to make sure that your proxy/localhost settings is setup correctly for your emulator. (A reference that might help: https://stackoverflow.com/a/59217370/10104608)

MHShetty commented 2 years ago

what ? im working localhost. lasterday you did new patch and i have taking error me and other pc

If your main device/computer is using the usual DHCP instead of static IP assignment, then it's possible that your computer might have got a new IP later after you first configured the proxy/localhost for your computer. Please make sure that you're emulator is setup the right port and IP by following the above guide.

zim32 commented 2 years ago

what ? im working localhost. lasterday you did new patch and i have taking error me and other pc

You can revert version, and test. I think the problem is not because of library. That's why I am asking about your setup

zim32 commented 2 years ago

Because your connection just stops in very early stage, even before library code kicks in and have chance to process packets from mysql server

MHShetty commented 2 years ago

Also, please go through what @zim32 has suggested once too (connecting to MySQL server, using the default port 3306 instead, etc.), if the above messages don't help.

Connecting to your MySQL server could be as simple as using your local computer system's terminal to run the mysql and then passing the username using the -u option and -p to specify the password (if present).

If your terminal can't find the mysql command then you might need to make sure it's in your PATH.

How are you interacting with your MySQL server though? If you're using a GUI based application like MySQL workbench, you can try connecting to the database from there and probably run a simple SELECT 1; query from there instead.

MHShetty commented 2 years ago

Please go through one message at a time and then try to figure out what could have possibly gone wrong

Emirgms commented 2 years ago

Also, please go through what @zim32 has suggested once too (connecting to MySQL server, using the default port 3306 instead, etc.), if the above messages don't help.

Connecting to your MySQL server could be as simple as using your local computer system's terminal to run the mysql and then passing the username using the -u option and -p to specify the password (if present).

If your terminal can't find the mysql command then you might need to make sure it's in your PATH.

How are you interacting with your MySQL server though? If you're using a GUI based application like MySQL workbench, you can try connecting to the database from there and probably run a simple SELECT 1; query from there instead.

im using workbench and i connected mysql.i think its no problem , https://stackoverflow.com/a/59217370/10104608) im did everything this website but i didnt work i will crazy im trying solve this problem 7-8 hours

Emirgms commented 2 years ago

i foundd !! this problem is mysql options

zim32 commented 2 years ago

i foundd !! this problem is mysql options

Can you share what was the cause of the problem?

Emirgms commented 1 year ago

https://stackoverflow.com/questions/50093144/mysql-8-0-client-does-not-support-authentication-protocol-requested-by-server its solved