\u9a8c\u8bc1<\/strong><\/span><\/div>\n\u8fdb\u5165\u65b0\u5efa\u7acb\u7684mysql \u5bb9\u5668<\/p>\n
docker esec -it faf90769b373 \/bin\/bash<\/pre>\n\u8fdb\u5165 MYSQL \u5bb9\u5668\u91cc\u7684\u6570\u636e\u5e93<\/p>\n
mysql -uroot -p<\/pre>\n\u663e\u793a\u5982\u4e0b \u6210\u529f<\/strong><\/span><\/div>\n root@faf90769b373:\/# mysql -uroot -p\r\nEnter password: \r\nWelcome to the MySQL monitor. Commands end with ; or \\g.\r\nYour MySQL connection id is 8\r\nServer version: 8.0.28 MySQL Community Server - GPL\r\n\r\nCopyright (c) 2000, 2022, Oracle and\/or its affiliates.\r\n\r\nOracle is a registered trademark of Oracle Corporation and\/or its\r\naffiliates. Other names may be trademarks of their respective\r\nowners.\r\n\r\nType 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.\r\n\r\nmysql> \r\n<\/pre>\n docker ps<\/pre>\n\u663e\u793a\u5982\u4e0b<\/strong><\/span><\/div>\n [root@localhost mysql]# docker ps\r\nCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES\r\nfaf90769b373 mysql \"docker-entrypoint.s\u2026\" 20 minutes ago Up 20 minutes 0.0.0.0:3306->3306\/tcp, :::3306->3306\/tcp, 33060\/tcp\r\n<\/pre>\ndocker\u4e2dMYSQL\u6570\u636e\u5907\u4efd<\/strong><\/div>\n1.\u8fdb\u5165\u65b0\u5efa\u7acb\u7684mysql \u5bb9\u5668 <\/strong><\/span><\/div>\n docker esec -it faf90769b373 \/bin\/bash<\/pre>\n 2.\u8fdb\u5165 MYSQL \u5bb9\u5668\u91cc\u7684\u6570\u636e\u5e93<\/strong><\/span><\/div>\n mysql -uroot -p<\/pre>\n 3.\u5efa\u7acb\u6570\u636e\u5e93\u53ca\u8868<\/strong><\/span><\/div>\n create database db01;\r\n use db01;\r\n create table t_book(id int not null primary key,bookName varchar(20) );\r\n show tables; \r\ninsert into t_book values(1,'java'); \r\nselect * from t_book;<\/pre>\n\u5b8c\u6210<\/strong><\/span><\/div>\n\u4f7f\u7528windows\u7684SQLyog\u8f6f\u4ef6 \u6d4b\u8bd5\u8fde\u63a5
\n\u5982\u679c\u51fa\u73b02058\u9519\u8bef \u8bf7\u5728\u5bb9\u5668\u4e2d \u6267\u884c\u4e0b\u9762\u547d\u4ee4<\/p>\n
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';<\/pre>\n4.\u628adocker\u91cc\u7684\u6570\u636e\u5e93\u5907\u4efd\u81f3\u672c\u5730<\/strong><\/span><\/div>\ndocker exec df6f2a96626f sh -c ' exec mysqldump --all-databases -uroot -p \"123456\" ' > \/data\/all-databases.sql<\/pre>\n","protected":false},"excerpt":{"rendered":"docker search mysql docker search mysql:5.7 docker pull […]<\/p>\n","protected":false},"author":1469,"featured_media":238875,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-238866","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/238866","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1469"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=238866"}],"version-history":[{"count":7,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/238866\/revisions"}],"predecessor-version":[{"id":238876,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/238866\/revisions\/238876"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/238875"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=238866"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=238866"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=238866"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}