Docker and install MySQL remote connections

 

  1. Acquiring MySQL Mirror
    docker pull mysql:5.6

     

  2. View mirror list
    docker images

     

  3. Start MySQL Mirror
    docker run -itd -P mysql:5.6 bash

     

  4. View Docker image has been running
    docker ps -a

     

  5. MySQL is connected to the mirror
    docker exec -it relaxed_hodgkin bash

     

  6. Start MySQL service
    service mysql start

     

  7. 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 ';

     

  8. Authorize root
    GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;

     

  9. Refresh and exit
    flush privileges;
    exit

     

  10. Restart MySQL service
    service mysql restart

     

  11. 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

     

 

Guess you like

Origin www.cnblogs.com/zhuminghui/p/11091046.html