title: SocketException: OS Error: Connection refused, errno = 111, address = localhost flutter with mysql1 package
body: <p>I am building flutter app with MySQL (not using phpMyAdmin) using mysql1 package (mysql1: ^0.19.2). I tried to make connection with the local host database. But got below error.</p>
  <pre><code>E/flutter ( 7011): [ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: SocketException: OS Error: Connection refused, errno 
  = 111, address = localhost
  </code></pre>
  <p>The code I used given below</p>
  <pre><code>import 'package:mysql1/mysql1.dart';
  
  class Mysql {
    static String host = 'localhost',
        user = 'root',
        password = 'abcd@1234',
        db = 'fluttertest';
    static int port = 3306;
  
    Mysql();
  
    Future&lt;MySqlConnection&gt; getConnection() async {
      var settings = new ConnectionSettings(
          host: host, port: port, user: user, password: password, db: db);
      return await MySqlConnection.connect(settings);
    }
  }
  </code></pre>
  <p>This is the function I used to check whether the connection works or not.</p>
  <pre><code>  void _dbCheck() {
      db.getConnection().then((value) async {
        await value.query('insert into user (email, password, ) values (?, ?)',
            ['Bob', 'bob@bob.com']);
      });
    }
  </code></pre>
  <p>Can anyone please help me to solve the issue?</p>
  <p>Thanks in advance.</p>