App overview screenshotSQL and Database Guides
PostgresMySQLSQLite
Try our free SQL Client
Tools
Connecting to MySQL
Connecting to Drivers
Installing MySQL
Setting up MySQL
MySQL   >   
Installing MySQL   >   
MySQL and Docker on Linux

Connect to MySQL with Docker on Linux

Get the Docker container

This one is easy. With docker installed, simply:

docker pull mysql

The latest version of MySQL as of this writing is MySQL 8, which also comes available in the Ubuntu APT repository on 20.04. On Ubuntu 18.04 the default MySQL is 5.7.

Run the Database

If you try to run the container wihtout arguments you will hit an error.

You must set the root password before connecting.

Instead, just like a native MySQL installation, you must supply the root password as the database initializes.

docker run -d -p 6033:3306 -e MYSQL_ROOT_PASSWORD=getarctype mysql

You should see a hash (the container ID) as output.

Connect to the MySQL Database

You can use a SQL client like Arctype to enter your database credentials and connect. The default user is root and the default database is mysql. For most docker installs, host networking will be enabled and so the host will be localhost.

Now simply hit Test Connection to check and the Save to start writing queries!

Get help on databases and SQL. Join our Discord community.