Mysql
Enter DB:
docker exec -it containerName /bin/bash
mysql -u root -p
Create database and user:
CREATE DATABASE `DatabaseNameHere`;
CREATE USER 'userHere'@'%' IDENTIFIED BY PASSWORD 'passwordHere';
GRANT ALL PRIVILEGES ON DatabaseNameHere.* TO 'userHere'@'%';
FLUSH PRIVILEGES;
the "PASSWORD" option is optional you can keep it or not it will do the same thing, This will hash the password but if you rather enter the hash instead of plain text password do:
SELECT PASSWORD('randomxyz');
+-------------------------------------------+
| PASSWORD('randomxyz') |
+-------------------------------------------+
| *F9EEB37B220FAD3C7CD03DFA967699E7D81EFC2C |
+-------------------------------------------+
1 row in set (0.001 sec)
This will output the hash and you can add that instead of the plain text password:
CREATE DATABASE `DatabaseNameHere`;
CREATE USER 'userHere'@'%' IDENTIFIED BY '*F9EEB37B220FAD3C7CD03DFA967699E7D81EFC2C';
GRANT ALL PRIVILEGES ON DatabaseNameHere.* TO 'userHere'@'%';
FLUSH PRIVILEGES;