Fixing Connection Problems with self-hosted MySQL Server Daemon

Problem 0

When running mysqld on a VirtualBox guest OS of Ubuntu Linux, connection was being refused.

Solution

Fixed by changing the bind-address value to 0.0.0.0 in mysqld.cnf

Command (edit as root with nano):

[email protected]:/etc/mysql/mysql.conf.d$ sudo nano mysqld.cnf

Edit:

[mysqld]

...

bind-address		= 0.0.0.0

Problem 1

The next problem was error 1130 (access denied).

Solution

Fixed this by enabling password authentication:

[email protected]:~$ sudo mysql -u root -p -h localhost -P 3306
Enter password: 

...

mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> GRANT ALL ON *.* to [email protected]'%' IDENTIFIED BY 'password';
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye
[email protected]:~$