[root@localhost etc]# vi /etc/docker/daemon.json{ "registry-mirrors": ["https://3laho3y3.mirror.aliyuncs.com"]}~~~"docker/daemon.json" 3L, 67C written[root@localhost etc]# systemctl daemon-reload[root@localhost etc]# systemctl restart docker[root@localhost etc]# docker pull mysql:5.7Trying to pull repository docker.io/library/mysql ... 5.7: Pulling from docker.io/library/mysql619014d83c02: Pull complete 9ced578c3a5f: Pull complete 731f6e13d8ea: Pull complete 3c183de42679: Pull complete 6de69b5c2f3c: Pull complete 00f0a4086406: Pull complete 84d93aea836d: Pull complete e2dd1f3e5a3d: Pull complete 98fb37478ee6: Pull complete 57eb21662ebf: Pull complete e95057f0a050: Pull complete Digest: sha256:cf6899e980c38071a78ded028de40e65286bfbbb746b97617ac4c9a84c4e812dStatus: Downloaded newer image for docker.io/mysql:5.7[root@localhost etc]#
[root@localhost etc]# docker run -itd -p 0.0.0.0:3307:3306 -P docker.io/mysql:5.7 bashe39d8a6d7ec1a654acd1bd78e7bbde6f4d53136934210210dba4fe0531be247c[root@localhost etc]# docker ps -aCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESe39d8a6d7ec1 docker.io/mysql:5.7 "docker-entrypoint..." 2 seconds ago Up 1 second 0.0.0.0:3307->3306/tcp, 0.0.0.0:32771->33060/tcp sad_einstein
[root@localhost etc]# docker exec -it sad_einstein bashroot@e39d8a6d7ec1:/# service mysql status[info] MySQL Community Server 5.7.29 is not running.root@e39d8a6d7ec1:/# service mysql startNo directory, logging in with HOME=/2020-02-02T13:32:09.362492Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).2020-02-02T13:32:09.905779Z 0 [Warning] InnoDB: New log files created, LSN=457902020-02-02T13:32:09.971187Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.2020-02-02T13:32:09.979450Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 69d485a0-45c0-11ea-b357-0242ac110002.2020-02-02T13:32:09.980341Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.2020-02-02T13:32:10.833825Z 0 [Warning] CA certificate ca.pem is self signed.2020-02-02T13:32:11.199597Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.No directory, logging in with HOME=/..[info] MySQL Community Server 5.7.29 is started.root@e39d8a6d7ec1:/# service mysql stop...[info] MySQL Community Server 5.7.29 is stopped.root@e39d8a6d7ec1:/# usermod -d /var/lib/mysql/ mysql^Croot@e39d8a6d7ec1:/# ls -lD /var/lib/mysql/ total 110668 -rw-r-----. 1 mysql mysql 56 Feb 2 13:32 auto.cnf -rw-------. 1 mysql mysql 1676 Feb 2 13:32 ca-key.pem -rw-r--r--. 1 mysql mysql 1112 Feb 2 13:32 ca.pem -rw-r--r--. 1 mysql mysql 1112 Feb 2 13:32 client-cert.pem -rw-------. 1 mysql mysql 1680 Feb 2 13:32 client-key.pem -rw-r-----. 1 mysql mysql 8116 Feb 2 13:32 e39d8a6d7ec1.err -rw-r-----. 1 mysql mysql 302 Feb 2 13:32 ib_buffer_pool -rw-r-----. 1 mysql mysql 50331648 Feb 2 13:32 ib_logfile0 -rw-r-----. 1 mysql mysql 50331648 Feb 2 13:32 ib_logfile1 -rw-r-----. 1 mysql mysql 12582912 Feb 2 13:32 ibdata1 drwxr-x---. 2 mysql mysql 4096 Feb 2 13:32 mysql drwxr-x---. 2 mysql mysql 8192 Feb 2 13:32 performance_schema -rw-------. 1 mysql mysql 1676 Feb 2 13:32 private_key.pem -rw-r--r--. 1 mysql mysql 452 Feb 2 13:32 public_key.pem -rw-r--r--. 1 mysql mysql 1112 Feb 2 13:32 server-cert.pem -rw-------. 1 mysql mysql 1680 Feb 2 13:32 server-key.pem drwxr-x---. 2 mysql mysql 8192 Feb 2 13:32 sys//DIRED// 65 73 124 134 185 191 242 257 308 322 373 389 440 454 505 516 567 578 629 636 687 692 743 761 812 827 878 892 943 958 1009 1023 1074 1077//DIRED-OPTIONS// --quoting-style=literalroot@e39d8a6d7ec1:/# ls -lD /var/lib/mysql/^C root@e39d8a6d7ec1:/# /var/lib/mysql/^Croot@e39d8a6d7ec1:/# usermod -d /var/lib/mysql/ mysqlroot@e39d8a6d7ec1:/# service mysql start..[info] MySQL Community Server 5.7.29 is started.root@e39d8a6d7ec1:/# mysqlWelcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 2Server version: 5.7.29 MySQL Community Server (GPL)Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> show databases -> ; -------------------- | Database | -------------------- | information_schema || mysql || performance_schema || sys | -------------------- 4 rows in set (0.00 sec)mysql> use mysqlReading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with -ADatabase changedmysql> update user set authentication_string = password('root') where user = 'root';Query OK, 1 row affected, 1 warning (0.00 sec)Rows matched: 1 Changed: 1 Warnings: 1mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;Query OK, 0 rows affected, 1 warning (0.00 sec)mysql>
本站僅提供存儲服務,所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請
點擊舉報。