Access denied to MySQL database in LXD container

I have installed a MySQL database, nuBuilder, in a LXD container on an Ubuntu host machine.

When I try to access the MySQL database, nuBuilder, from the browser on the host via the container’s IP address, I get this message:

Connection failed: SQLSTATE[HY000] [1045] Access denied for user ‘nuadmin’@‘localhost’ (using password: YES)

nuadmin is a MySQL database user. I set the password in the appropriate file, nuconfig.php

I would appreciate your help! I am a new user of LXD and MySQL, so forgive me for missing anything easy. If I should go to a MySQL forum instead of this one, please let me know. Thank you!


In Ubuntu, the mysql package is configured by default so that the MySQL server listens to localhost (the lo network interface). This is good for security so that a typical installation of MySQL does not make it accessible from the network.

If you have installed nuBuilder in the same container as MySQL, then it should work fine with localhost.

But if you installed nuBuilder in another container (which is more elegant to do), you would need to change the configuration in MySQL so that it accepts connections from other IP addresses.

Change the following from

# bind-address    =


bind-address    =

This configuration makes MySQL to bind all network interfaces (, therefore it becomes accessible from other containers or even the host itself. Finally, restart the MySQL service so that the change takes effect.

Thank you, @simos It is now working!
I made your change after tracking down the my.cnf file.

In the LXD container for nuBuilder it is here:

The problem still was not resolved, but that was because the nuadmin user did not exist in MySQL! I am not sure why the installation procedure did not create this user. Once created and given appropriate permissions, I was able to log in. Yay! Thanks again.
edit: typo