- Acquiring MySQL Mirror
docker pull mysql:5.6
- View mirror list
docker images
- Start MySQL Mirror
docker run -itd -P mysql:5.6 bash
- View Docker image has been running
docker ps -a
- MySQL is connected to the mirror
docker exec -it relaxed_hodgkin bash
- Start MySQL service
service mysql start
- Changing the root password
MySQL use; # into the administrator's database Update User SET = authentication_string password ( ' 123456 ' ) WHERE User = ' the root ' ; # Change password is 123456
# Update User password SET PASSWORD = ( '123456') WHERE User = 'the root '; - Authorize root
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;
- Refresh and exit
flush privileges; exit
- Restart MySQL service
service mysql restart
- Another Docker can connect the MySQL up
mysql -u root -h IP address of the MySQL service is located - the p- # Enter, enter the password (tutorial is 123456) on OK