< Docker

Docker/MySQL

Try It

Online Free

  1. Use Play with Docker. Create an account and/or log in.
  2. Start an interactive session and add a new instance.
  3. In the terminal window, enter the following commands:
    • docker run --name mysql-server -e MYSQL_ROOT_PASSWORD=secret -d mysql
  4. To connect to the mysql-server:
    • docker exec -it mysql-server bash
    • mysql -u root -p
      Enter secret for the root password when prompted.

On Your Own System

  1. Install Docker Desktop or the Docker Engine.
  2. In a terminal window, enter the following commands:
    • docker run --name mysql-server -e MYSQL_ROOT_PASSWORD=secret -d mysql
  3. To connect to the mysql-server:
    • docker exec -it mysql-server bash
    • mysql -u root -p
      Enter secret for the root password when prompted.

See Also

This article is issued from Wikiversity. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.