0

I am currently trying to setup a database connection between my server (command line server) and my localhost xampp mysql. this is running in my main function:

main() async {
  var pool = new ConnectionPool(
    host: 'localhost', port: 1234,
    user: 'root', password: 'password',
    db: 'angularsite', max: 5);

  var results = await pool.query("select * from discussions");

  results.forEach((row) {
    print('Row: ${row}');
  });
}

As you can see, it's basically the example that sqljocky provides. I just replaced the credentials with mine. I don't get an error message, nothing happens. From using the good old print method I know that the execution of the code doesn't go beyond the "pool.query" line. (The ConnectionPool does indeed instanciate)

Anything I did wrong?

Thanks in advance

OhMad
  • 6,871
  • 20
  • 56
  • 85

1 Answers1

1

The problem I had was that I was refering to the port of my localhost, and not to the port of MySql only. Entering 3306 as the port worked for me.

OhMad
  • 6,871
  • 20
  • 56
  • 85