{"id":291,"date":"2023-02-24T21:55:46","date_gmt":"2023-02-24T13:55:46","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=291"},"modified":"2023-04-30T15:11:51","modified_gmt":"2023-04-30T07:11:51","slug":"config-phpmyadmin-connect-to-multiple-instances-of-mysql","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/02\/24\/config-phpmyadmin-connect-to-multiple-instances-of-mysql\/","title":{"rendered":"\u914d\u7f6ephpMyAdmin\u8fde\u63a5\u591a\u5b9e\u4f8bMySQL"},"content":{"rendered":"<pre><code>cp config.sample.inc.php config.inc.php\nvim config.inc.php<\/code><\/pre>\n<p><!-- more --><\/p>\n<pre><code class=\"language-php\">\/**\n * First server\n *\/\n\/\/$i++;\n\/* Authentication type *\/\n\/\/$cfg[&#039;Servers&#039;][$i][&#039;auth_type&#039;] = &#039;cookie&#039;;\n\/* Server parameters *\/\n\/\/$cfg[&#039;Servers&#039;][$i][&#039;host&#039;] = &#039;master.rds.aliyun.com&#039;;\n\/\/$cfg[&#039;Servers&#039;][$i][&#039;compress&#039;] = false;\n\/\/$cfg[&#039;Servers&#039;][$i][&#039;AllowNoPassword&#039;] = false;\n\n$hosts = array(\n  &#039;1&#039; =&gt; array(&#039;host&#039;=&gt;&#039;master.rds.aliyun.com&#039;, &#039;port&#039;=&gt;3306),\n  &#039;2&#039; =&gt; array(&#039;host&#039;=&gt;&#039;slave.rds.aliyun.com&#039;, &#039;port&#039;=&gt;3306)\n);\n\nfor ($i=1; $i&lt;=count($hosts); $i++) {\n  \/* Authentication type *\/\n  $cfg[&#039;Servers&#039;][$i][&#039;auth_type&#039;] = &#039;cookie&#039;;\n  \/* Server parameters *\/\n  $cfg[&#039;Servers&#039;][$i][&#039;host&#039;] = $hosts[$i][&#039;host&#039;];  \/\/\u4fee\u6539host\n  $cfg[&#039;Servers&#039;][$i][&#039;port&#039;] = $hosts[$i][&#039;port&#039;]; \n  $cfg[&#039;Servers&#039;][$i][&#039;connect_type&#039;] = &#039;tcp&#039;;\n  $cfg[&#039;Servers&#039;][$i][&#039;compress&#039;] = false;\n  \/* Select mysqli if your server has it *\/\n  $cfg[&#039;Servers&#039;][$i][&#039;extension&#039;] = &#039;mysqli&#039;;\n  \/\/$cfg[&#039;Servers&#039;][$i][&#039;AllowNoPassword&#039;] = true;\n  \/\/$cfg[&#039;Servers&#039;][$i][&#039;user&#039;] = $hosts[$i][&#039;user&#039;];  \/\/\u4fee\u6539\u7528\u6237\u540d\n  \/\/$cfg[&#039;Servers&#039;][$i][&#039;password&#039;] = $hosts[$i][&#039;password&#039;];  \/\/\u5bc6\u7801\n  \/* rajk - for blobstreaming *\/\n  $cfg[&#039;Servers&#039;][$i][&#039;bs_garbage_threshold&#039;] = 50;\n  $cfg[&#039;Servers&#039;][$i][&#039;bs_repository_threshold&#039;] = &#039;32M&#039;;\n  $cfg[&#039;Servers&#039;][$i][&#039;bs_temp_blob_timeout&#039;] = 600;\n  $cfg[&#039;Servers&#039;][$i][&#039;bs_temp_log_threshold&#039;] = &#039;32M&#039;;\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>cp config.sample.inc.php config.inc.php vim config.inc. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[94],"class_list":["post-291","post","type-post","status-publish","format-standard","hentry","category-devops-base","tag-phpmyadmin"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/291","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=291"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/291\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=291"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=291"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=291"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}