Skip to content

Instantly share code, notes, and snippets.

@Aruw
Last active October 7, 2023 23:48
Show Gist options
  • Save Aruw/f7c35ba9701bb07a8b2242db8804a564 to your computer and use it in GitHub Desktop.
Save Aruw/f7c35ba9701bb07a8b2242db8804a564 to your computer and use it in GitHub Desktop.
Setup MySQL with Docker on local environment and configure DBeaver connection.

In the CLI pull MySQL image:

docker pull mysql/mysql-server:latest

docker run -d -p 3306:3306 
  --name your-container-name
  -e MYSQL_ROOT_PASSWORD=password 
  mysql/mysql-server:latest

Open the container terminal:

mysql -u root -p
CREATE USER 'yourUser'@'172.17.0.1' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'yourUser'@'172.17.0.1' WITH GRANT OPTION;
flush privileges;
CREATE DATABASE yourDatabase;
exit

Setup DBeaver URL

jdbc:mysql://host.docker.internal:3306/yourDatabase?allowPublicKeyRetrieval=true&useSSL=false

Example of how the DBeaver connection should look like

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment