Once initialization is finished, the command's output is going to contain the random password generated for the root user; check the password with, for example, this command:
shell> docker logs mysql1 2>&1 | grep GENERATED
GENERATED ROOT PASSWORD: Axegh3kAJyDLaRuBemecis&EShOs
Once the server is ready, you can run the mysql client within the MySQL Server container you just started and connect it to the MySQL Server. Use the docker exec -it command to start a mysql client inside the Docker container you have started, like this:
shell> docker exec -it mysql1 mysql -uroot -p
When asked, enter the generated root password (see the instructions above on how to find it). Because the MYSQL_ONETIME_PASSWORD option is true by default, after you have connected a mysql client to the server, you must reset the server root password by issuing this statement:
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'password';
Substitute password with the password of your choice. Once the password is reset, the server is ready for use.
https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-ubuntu-18-04
CREATE USER 'nahid'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'nahid'@'%' WITH GRANT OPTION;
ALTER USER 'nahid'@'%' IDENTIFIED WITH mysql_native_password BY 'password';
Content type
Image
Digest
Size
135.3 MB
Last updated
almost 6 years ago
docker pull nahidacm/mysql-server