# MySQL
# Create MySQL server inside container
docker run --name mysql-test -p 3377:3306 -e MYSQL_ROOT_PASSWORD=password -d mysql:latest
This runs the latest version of MySQL on port 3377 (host) with root user, and password set to 'password'.
After that we create a new user inside a container.
docker exec -it mysql-test mysql -u root -p
CREATE USER 'imagdic' IDENTIFIED BY 'imagdic123';
GRANT ALL ON *.* TO 'imagdic'@'%';
FLUSH PRIVILEGES;
Now we are ready to use our MySQL container with user 'imagdic' and password 'imagdic123' from our host machine.
Laravel application: if you are getting
driver not found
, make sure your 'extension=pdo_mysql' is uncommented in php.ini (/etc/php/php.ini)
DBeaver: If you are using DBeaver and MySQL 8+ version, you might get following error:
Public Key Retrieval is not allowed
You need to add 'allowPublicKeyRetrieval' and set it to 'true' inside connection properties. Visit https://community.atlassian.com/t5/Confluence-questions/MySQL-Public-Key-Retrieval-is-not-allowed/qaq-p/778956 for more information.