title: Mysql MariaDB is not working with remote connections
body: <p>I've been scratching my head for a day and probably read so many articles and on how can I allow my MariaDB to listen to remote connections. Unfortunately getting the below error.</p>
  <pre><code>Host 'xxx.xxx.xxx.xxx' is not allowed to connect to this MariaDB server.
  </code></pre>
  <p>I also read this StackOverflow <a href="https://stackoverflow.com/questions/1559955/host-xxx-xx-xxx-xxx-is-not-allowed-to-connect-to-this-mysql-server">question</a>, <a href="https://stackoverflow.com/questions/21664091/mariadb-not-allowing-remote-connections">anotherQuestion</a> and successfully able to create the new user and grant all permission with following MySQL query.</p>
  <pre><code>CREATE USER 'ahsensaeed'@'%' IDENTIFIED BY 'my_password';
  GRANT ALL PRIVILEGES ON *.* TO 'ahsensaeed'@'%' WITH GRANT OPTION;
  </code></pre>
  <p>And below is my <strong>ahsensaeed</strong> user grants.</p>
  <pre><code>MariaDB [mysql]&gt; show grants for 'ahsensaeed'@'%';
  +--------------------------------------------------------------------------------------------------------------------------------------+
  | Grants for ahsensaeed@%                                                                                                              |
  +--------------------------------------------------------------------------------------------------------------------------------------+
  | GRANT ALL PRIVILEGES ON *.* TO 'ahsensaeed'@'%' IDENTIFIED BY PASSWORD '*F794ABE2A12665587C6B6D8B61E2F7E987711AFA' WITH GRANT OPTION |
  +--------------------------------------------------------------------------------------------------------------------------------------+
  1 row in set (0.00 sec)
  </code></pre>
  <p>In the end, I just flush the privileges and after that, I go to my MariaDB configuration file and edit it. Below is the path where my MariaDB conf file placed.</p>
  <pre><code>/etc/mysql/mariadb.conf.d/50-server.cnf 
  </code></pre>
  <p>The following shows my MariaDB file block.</p>
  <pre><code>[mysqld]
  
  #
  # * Basic Settings
  #
  user        = mysql
  pid-file    = /var/run/mysqld/mysqld.pid
  socket      = /var/run/mysqld/mysqld.sock
  port        = 3306
  basedir     = /usr
  datadir     = /var/lib/mysql
  tmpdir      = /tmp
  lc-messages-dir = /usr/share/mysql
  skip-external-locking
  
  # Instead of skip-networking the default is now to listen only on
  # localhost which is more compatible and is not less secure.
  bind-address = 0.0.0.0
  .....
  .....
  </code></pre>
  <p>and then I just restart the <strong>mysql</strong> service via /etc/init.d/mysql restart. I also open the 3306 port on my client for <strong>mysql</strong>.</p>
  <p>When the above solution not works I also add the <strong>bind-address = 0.0.0.0</strong> in /etc/mysql/conf.d/mysql.cnf file, but still it failed with error.</p>
  <p>The following shows how I requesting for MariaDB database from my server.</p>
  <blockquote>
  <p>-&gt; mysql -uahsensaeed -p -h hostIp</p>
  </blockquote>
  <p>and then I got the below error.</p>
  <blockquote>
  <p>ERROR 1130 (HY000): Host 'hostIp' is not allowed to connect to this MariaDB server</p>
  </blockquote>
  <p><strong>Edit</strong> Added the host and user data.</p>
  <pre><code>MariaDB [(none)]&gt; select User,Host from mysql.user;
  +------------+-----------+
  | User       | Host      |
  +------------+-----------+
  | ahsensaeed | %         |
  | root       | localhost |
  +------------+-----------+
  2 rows in set (0.00 sec)
  </code></pre>
  <p>Any help would be appreciated.</p>