How do I access MySQL instance created by LAMP image when creating droplet?

I can’t figure out how would I access my MySQL instance that has been created as a part of one-click LAMP installation when creating droplet.

Specifically, where will I find the hostname, username, password, port for connecting to MySQL?

Can I connect to it using MySQL Workbench client installed on my local machine? Or will I have to connect through command line? If yes, how?

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

By default, MySql is only accessible on the local host as it’s bound to You can see this in it’s configuration file:

# cat  /etc/mysql/my.cnf | grep bind
bind-address		=

If you comment out that line and restart MySql (sudo service mysql restart), it will become available remotely.

When you first log on to the server, the root MySql password is displayed:

Thank you for using DigitalOcean's LAMP Application.
Your web root is located at /var/www/html and can be seen from
The details of your PHP installation can be seen at
Your MySQL root user's password is 68aKdJVbQx
You are encouraged to run mysql_secure_installation to ready your server for production.

Especially if you plan on allowing remote access to the database, run mysql_secure_installation in order to disable remote access via the root account. After you’ve done this, you can create a user with remote access.

CREATE USER 'your_user'@'your_local_IP' IDENTIFIED BY 'new_password';
GRANT ALL PRIVILEGES ON 'your_database'.* TO 'your_user'@'your_local_IP';

Replace the highlighted values with the ones you need.

So to answer your question, if you want to allow remote access you must set the username and password yourself. The “host” is the IP address of your server and the port is 3306.