Advertisement
Guest User

Untitled

a guest
Jun 30th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. FROM mysql
  2. RUN mysql_config_editor set --login-path=local --user=root --password
  3.  
  4. root@d80484a3177f:~# mysql_config_editor set --login-path=local --user=root --password
  5. Enter password:
  6.  
  7. root@d80484a3177f:~# mysql_config_editor set --login-path=local --user=root --password=root
  8. mysql_config_editor: [ERROR] mysql_config_editor: option '--password' cannot take an argument
  9.  
  10. FROM mysql:5.7
  11.  
  12. RUN apt-get update && apt-get --no-install-recommends --no-install-suggests -y install expect
  13.  
  14. ENV MYSQL_ROOT_PASSWORD "secure_root_password"
  15.  
  16. ADD mysql_config.sh /root/mysql_config.sh
  17. RUN cd /root && ./mysql_config.sh $MYSQL_ROOT_PASSWORD
  18.  
  19. #!/usr/bin/expect
  20.  
  21. set pwd [lindex $argv 0];
  22.  
  23. spawn mysql_config_editor set --login-path=local --host=localhost --user=root --password
  24. expect -nocase "Enter password:" {send "${pwd}r"; interact}
  25.  
  26. $ docker exec -it your-mysql-container mysql --login-path=local
  27. Welcome to the MySQL monitor. Commands end with ; or g.
  28. Your MySQL connection id is 6
  29. Server version: 5.7.18 MySQL Community Server (GPL)
  30.  
  31. Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
  32.  
  33. Oracle is a registered trademark of Oracle Corporation and/or its
  34. affiliates. Other names may be trademarks of their respective
  35. owners.
  36.  
  37. Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
  38.  
  39. mysql>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement