{"id":15485,"date":"2024-10-26T19:02:50","date_gmt":"2024-10-26T11:02:50","guid":{"rendered":"https:\/\/www.orczhou.com\/?p=15485"},"modified":"2025-05-11T10:50:04","modified_gmt":"2025-05-11T02:50:04","slug":"install-mysql-9-1-with-docker","status":"publish","type":"post","link":"https:\/\/www.orczhou.com\/index.php\/2024\/10\/install-mysql-9-1-with-docker\/","title":{"rendered":"\u5b89\u88c5\u4f53\u9a8cMySQL 9.1 \uff08Docker \u5b89\u88c5\uff09"},"content":{"rendered":"\n<p>Docker \u5b89\u88c5\u975e\u5e38\u7b80\u5355\uff0c\u51e0\u4e4e\u4e00\u5206\u949f\u5185\u5373\u53ef\u5b8c\u6210\u5b89\u88c5\u3002<\/p>\n\n\n\n\n\n\n<h4 class=\"wp-block-heading\">Docker \u5b89\u88c5 MySQL 9.1<\/h4>\n\n\n\n<p>\u5b89\u88c5\u955c\u50cf\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">docker pull container-registry.oracle.com\/mysql\/community-server:9.1<\/code><\/pre>\n\n\n\n<p>\u542f\u52a8\u955c\u50cf\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">docker run --name=mysql91  --restart on-failure -d container-registry.oracle.com\/mysql\/community-server:9.1<\/code><\/pre>\n\n\n\n<p>\u67e5\u770b\u521d\u59cb\u5b89\u88c5\u65f6 <code>root<\/code> \u8d26\u53f7\u5bc6\u7801\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">docker logs mysql91 2&gt;&amp;1 | grep GENERATED<\/code><\/pre>\n\n\n\n<p>\u767b\u5f55\u5b89\u88c5\u7684\u6570\u636e\u5e93\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">docker exec -it mysql91 mysql -uroot -p<\/code><\/pre>\n\n\n\n<p>\u597d\u4e86\u3002\u8fd9\u5c31\u5b8c\u6210\u5b89\u88c5\u4e86\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\"># docker exec -it mysql91 mysql -uroot -p\nEmulate Docker CLI using podman. Create \/etc\/containers\/nodocker to quiet msg.\nEnter password:\nWelcome to the MySQL monitor.  Commands end with ; or \\g.\nYour MySQL connection id is 10\nServer version: 9.1.0\n\nCopyright (c) 2000, 2024, Oracle and\/or its affiliates.\n\nOracle is a registered trademark of Oracle Corporation and\/or its\naffiliates. Other names may be trademarks of their respective\nowners.\n\nType 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.\n\nmysql&gt;<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p>\u4fee\u6539 <code>root<\/code> \u5bc6\u7801\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">ALTER USER 'root'@'localhost' IDENTIFIED BY 'YOUR-NEW-PASSWORD';<\/code><\/pre>\n\n\n\n<p>\u8be6\u7ec6\u7684\u6b65\u9aa4\u4e0e\u8bf4\u660e\u53ef\u4ee5\u53c2\u8003\uff1a<a href=\"https:\/\/dev.mysql.com\/doc\/refman\/9.0\/en\/docker-mysql-getting-started.html\" target=\"_blank\" rel=\"noreferrer noopener\">Basic Steps for MySQL Server Deployment with Docker<\/a>\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">\u5176\u4ed6\u7684 Docker \u76f8\u5173\u7ba1\u7406\u547d\u4ee4<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">docker start    mysql91 # \u542f\u52a8\ndocker stop     mysql91 # \u5173\u95ed\ndocker restart  mysql91 # \u91cd\u542f\n\ndocker rm       mysql91  # \u5220\u9664\u5bb9\u5668<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">\u4f53\u9a8c MySQL 9.0\/9.1 \u7cfb\u5217<\/h4>\n\n\n\n<p>\u521b\u5efa\u6570\u636e\u5e93\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">mysql&gt; create database orczhou;\nQuery OK, 1 row affected (0.00 sec)\n\nmysql&gt; use orczhou\nDatabase changed<\/code><\/pre>\n\n\n\n<p>\u521b\u5efa\u4e00\u4e2a\u8868\uff0c\u53ef\u4ee5\u7528\u4e8e\u5b58\u50a8\u5411\u91cf\uff0c\u5e76\u8fdb\u884c\u7b80\u5355\u7684\u5411\u91cf\u8ba1\u7b97\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"sql\" class=\"language-sql\">create table vector_t01 (\n    id int,\n    s_v_01 vector(390),\n    s_v_02 vector(390)\n);\n\nmysql> create table vector_t01(id int,s_v_01 vector(390),s_v_02 vector(390));\nQuery OK, 0 rows affected (0.02 sec)\n\nmysql> insert into vector_t01 values (1,string_to_vector('[1,2,3]'),string_to_vector('[4,5,6]'));\nQuery OK, 1 row affected (0.00 sec)\n\nmysql> select DISTANCE(s_v_01,s_v_02) FROM vector_t01;\nERROR 1305 (42000): FUNCTION orczhou.DISTANCE does not exist<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">\u5565\uff01<code>FUNCTION DISTANCE does not exist<\/code><\/h4>\n\n\n\n<p>\u770b\u770b\u6587\u6863\u63cf\u8ff0\uff0c\u6211\u4e0b\u5df4\u6389\u4e86\u4e00\u5730\uff08<a href=\"https:\/\/dev.mysql.com\/doc\/refman\/9.0\/en\/vector-functions.html#function_distance\">\u53c2\u8003<\/a>\uff09\uff1a<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>Note<\/p>\n\n\n\n<p><code>DISTANCE()<\/code>&nbsp;is available only for users of HeatWave MySQL on OCI; it is not included in MySQL Commercial or Community distributions.<\/p>\n<\/blockquote>\n\n\n\n<p>\u6ca1\u6709<code>search<\/code>\u5c31\u7b97\u4e86\uff0c\u597d\u4e0d\u5bb9\u6613\u6709\u4e00\u4e2a <code>DISTANCE<\/code>\uff0c\u53d1\u73b0\u8fd8\u662f\u53d7\u9650\u5236\u7684&#8230;<\/p>\n\n\n\n<p>\u597d\u4e86\uff0c\u90a3\u5c31\u4f53\u9a8c\u5230\u8fd9\u91cc\u5427&#8230; \u671f\u5f85\u5728\u540e\u7eed\u7684\u7248\u672c\u80fd\u591f\u628a\u641c\u7d22\u529f\u80fd\u8865\u9f50\u3002\u4e00\u5b9a\u8981\u4f53\u9a8c\u7684\u8bdd\uff0c\u53ef\u4ee5\u81ea\u5df1\u53bbOracle Cloud\u8fdb\u884c\u6d4b\u8bd5\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">\u53c2\u8003\u94fe\u63a5<\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/dev.mysql.com\/doc\/refman\/9.0\/en\/docker-mysql-getting-started.html\" target=\"_blank\" rel=\"noreferrer noopener\">Basic Steps for MySQL Server Deployment with Docker<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/dev.mysql.com\/doc\/refman\/9.0\/en\/docker-mysql-more-topics.html\" target=\"_blank\" rel=\"noreferrer noopener\">More Topics on Deploying MySQL Server with Docker<\/a><\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Docker \u5b89\u88c5\u975e\u5e38\u7b80\u5355\uff0c\u51e0\u4e4e\u4e00\u5206\u949f\u5185\u5373\u53ef\u5b8c\u6210\u5b89\u88c5\u3002 Docker \u5b89\u88c5 MySQL 9.1 \u5b89\u88c5\u955c\u50cf\uff1a \u542f\u52a8\u955c\u50cf\uff1a \u67e5\u770b\u521d\u59cb\u5b89\u88c5\u65f6 root \u8d26\u53f7\u5bc6\u7801\uff1a \u767b\u5f55\u5b89\u88c5\u7684\u6570\u636e\u5e93\uff1a \u597d\u4e86\u3002\u8fd9\u5c31\u5b8c\u6210\u5b89\u88c5\u4e86\uff1a \u4fee\u6539 root \u5bc6\u7801\uff1a \u8be6\u7ec6\u7684\u6b65\u9aa4\u4e0e\u8bf4\u660e\u53ef\u4ee5\u53c2\u8003\uff1aBasic Steps for MySQL Server Deployment with Docker\u3002 \u5176\u4ed6\u7684 Docker \u76f8\u5173\u7ba1\u7406\u547d\u4ee4 \u4f53\u9a8c MySQL 9.0\/9.1 \u7cfb\u5217 \u521b\u5efa\u6570\u636e\u5e93\uff1a \u521b\u5efa\u4e00\u4e2a\u8868\uff0c\u53ef\u4ee5\u7528\u4e8e\u5b58\u50a8\u5411\u91cf\uff0c\u5e76\u8fdb\u884c\u7b80\u5355\u7684\u5411\u91cf\u8ba1\u7b97\uff1a \u5565\uff01FUNCTION DISTANCE does not exist \u770b\u770b\u6587\u6863\u63cf\u8ff0\uff0c\u6211\u4e0b\u5df4\u6389\u4e86\u4e00\u5730\uff08\u53c2\u8003\uff09\uff1a Note DISTANCE()&nbsp;is available only for users of HeatWave MySQL on OCI; it is not included in [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_eb_attr":"","inline_featured_image":false,"_tocer_settings":[],"footnotes":""},"categories":[1],"tags":[],"class_list":["post-15485","post","type-post","status-publish","format-standard","hentry","category-simplelife"],"_links":{"self":[{"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/posts\/15485","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/comments?post=15485"}],"version-history":[{"count":14,"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/posts\/15485\/revisions"}],"predecessor-version":[{"id":18322,"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/posts\/15485\/revisions\/18322"}],"wp:attachment":[{"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/media?parent=15485"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/categories?post=15485"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/tags?post=15485"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}