Host OS is Windows10. Guest OS is Ubuntu 18.04 running on Oracle VirtualBox.

In the VirtualBox setting I set the Network setting to NAT and set up port forwarding (> ... did the same with port 22 and 80 )

In the browser, I can reach the localhost when I go to

In the terminal, I can connect through SSH successfully with [email protected].

But when I try to use mySQL Workbench to connect to mysql I get an error.

Lost connection to mySQL server at 'reading initial communication packet', system error: 0

my Workbench connection setting is:

Conection Method: Standard TCP/IP

Hostname: Port: 3306

Username: root or admin user.

I edited the my.cnf file to bind address

# The MySQL database server configuration file.
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

# * IMPORTANT: Additional settings that can override those from this file!
#   The files must end with '.cnf', otherwise they'll be ignored.

!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/
bind-address =

I tried to connect with my 'root' user and password. I created an 'admin' user and gave it all privileges and still no success.

Any help is greatly appreciated. This is my first trying to run my local server on VirtualBox, so I might be missing something very basic.

Thank you!

1 Answer 1


This solved my probelm.

I added bind-address = in etc/mysql/my.cnf and that is NOT correct.

For Ubuntu 18.04 the file to edit the bind-address is etc/mysql/mysql.conf.d/mysqld.cnf There will actually be a line in the file that says bind-address:, change that to

After, restart mysql by running this command

sudo service mysql restart

NOTE: Using Ubuntu root user and password ( like I mentioned in the question ) will not work, you have to create another mySQL user with admin rights.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .