<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="7" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[7]</anchor-end> <dfn>MySQL</dfn> は、<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">データベース</anchor>です。</p><section><h1>MySQL over TLS</h1><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="2" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[2]</anchor-end> <anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">TLS</anchor> が有効かどうかは <code>SHOW STATUS LIKE &quot;Ssl_cipher&quot;</code> で確認できます。
適当な <anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">cipher</anchor> が返ってきたら、 <anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">TLS</anchor> が有効です。</p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="3" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[3]</anchor-end> <kbd>mysql</kbd> <anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">コマンド</anchor>ほかいくつかの<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">クライアントライブラリー</anchor>は
<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">TLS</anchor> が指定されていてもそれが適用されなかった場合にも、これをエラーとしないので、
注意が必要です。</p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="33" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[33]</anchor-end> mysql クライアントから ClearDB サーバーに接続するには</p><pre class="code bash">$ mysql --user=XXX --password=XXX --host=XXX XXX --ssl-ca=cleardb-ca.pem --ssl-cert=XXX-cert.pem --ssl-key=XXX-key.pem</pre><p>最初の4つのXXXは Heroku の設定変数として設定されている CLEARDB_DATABASE_URL の値から採る。最後の3つのファイルは Heroku の設定ページから ClearDB のページに行き、ダウンロードする (ログイン必要なのでブラウザで保存する)。</p><p>秘密鍵のエラーが出る時は (OpenSSL のバージョンの問題らしい)、<pre class="code bash">$ openssl rsa -in XXX-key.pem -out XXX-key-pkcs1.pem</pre>... として作られたファイルを指定すれば良い。</p><p>本当に SSL で接続できたかは<pre class="code bash">SHOW STATUS LIKE 'Ssl_cipher';</pre>... で値が空文字列になっていないかどうかで確認できる。
<time>2014-10-12</time></p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="34" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[34]</anchor-end> Perl の DBI で接続する時は<pre class="code">DBI:mysql:database=%s;host=%s;user=%s;password=%s;mysql_ssl=1;mysql_ssl_ca_file=%s;mysql_ssl_client_cert=%s;mysql_ssl_client_key=%s</pre>... のような dsn で同じ要領で接続できる。ただし DBD::mysql は標準では SSL 無効でコンパイルされる。その場合 mysql_ssl* は無視されるので注意しないといけない。無視されるがエラーにならずに平文で接続できてしまう。</p><p>DBD::mysql インストール時の Makefile.PL でオプション --ssl をつけると SSL 付きでコンパイルされる。 cpanm でインストールするなら --configure-args=--ssl をつければ良い。 pmbp.pl を使うなら今日の版以降は標準で --ssl 付きでコンパイルされる。</p><p>SSL なしで接続できてしまうのは怖いが、 MySQL で SSL 固定にするには GRANT ほにゃららを実行するらしい。 ClearDB では GRANT を実行する権限がなさそう (未確認)。</p><p>接続時に SHOW STATUS LIKE 'Ssl_cipher' して確認する実装にしておかないと怖い。
<time>2014-10-12</time></p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="35" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[35]</anchor-end> AnyEvent::MySQL は SSL に対応していない。
<time>2014-10-12</time></p></section><section><h1>Docker 版</h1><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="30" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[30]</anchor-end> <cite>mysql/mysql-server - Docker Hub</cite> (<time>2017-03-19 19:09:03 +09:00</time> 版) <anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="https://hub.docker.com/r/mysql/mysql-server/">https://hub.docker.com/r/mysql/mysql-server/</anchor-external></p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="4" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[4]</anchor-end> <cite xml:lang="ja">Dockerの公式MySQLイメージの使い方を徹底的に解説するよ · DQNEO起業日記</cite>
( (<time>2016-06-14 17:32:26 +09:00</time>))
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="http://dqn.sakusakutto.jp/2015/10/docker_mysqld_tutorial.html">http://dqn.sakusakutto.jp/2015/10/docker_mysqld_tutorial.html</anchor-external></p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="6" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[6]</anchor-end> (<time>2016-08-15 18:36:29 +09:00</time>)
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="https://hub.docker.com/_/mysql/">https://hub.docker.com/_/mysql/</anchor-external></p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="31" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[31]</anchor-end> なぜかサーバーが起動せず、 <code>docker logs</code> を見ても特にエラーも無いときは、
<code>docker</code> の <code>-d</code> を付けずに実行すると、エラーが出ていることがあります。</p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="32" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[32]</anchor-end> <anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">環境変数</anchor>の組み合わせが間違っているとかで、わりと簡単に <anchor-internal xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="31" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">&gt;&gt;31</anchor-internal> のような状況になるようです。</p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="36" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[36]</anchor-end> <anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">CircleCI</anchor> で実行すると <code>mbind: Invalid argument</code>
というエラーが出まくるようですが、これ自体は無視して構わず、そのまま起動するなら問題ないようです。
<time>2018-05-18T13:51:43.00Z</time></p></section><section><h1><code class="URI" xml:lang="en">mysql:</code> URL scheme</h1><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="8" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[8]</anchor-end> <cite>Extended indexing features</cite> <anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="http://www.dataparksearch.org/dpsearch-extended-indexing.en.html#htdb">http://www.dataparksearch.org/dpsearch-extended-indexing.en.html#htdb</anchor-external>
(<time>2006-03-20 13:56:51 +00:00</time>)</p><figure class="quote"><figcaption><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="9" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[9]</anchor-end> <src xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:10:"><anchor-internal xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="8" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">&gt;&gt;8</anchor-internal></src></figcaption><blockquote><pre class="code URI">mysql://foo:bar@localhost/search/?dbmode=single</pre></blockquote></figure><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="10" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[10]</anchor-end> <cite xml:lang="en">Engine Configuration — SQLAlchemy 0.7 Documentation</cite>
( (<time>2012-10-28 05:05:12 +09:00</time> 版))
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="http://docs.sqlalchemy.org/en/rel_0_7/core/engines.html#database-urls">http://docs.sqlalchemy.org/en/rel_0_7/core/engines.html#database-urls</anchor-external></p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="11" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[11]</anchor-end> <cite>felixge/node-mysql · GitHub</cite> (<time>2013-05-09 08:29:39 +09:00</time> 版) <anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="https://github.com/felixge/node-mysql">https://github.com/felixge/node-mysql</anchor-external></p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="12" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[12]</anchor-end> <anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">mysqld</anchor> の既定の<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">ポート番号</anchor>は <n xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">3306</n>。</p><figure class="quote"><figcaption><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="13" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[13]</anchor-end> <cite>Mojo::MySQL5::URL - search.cpan.org</cite>
(<time>2015-07-09 00:25:59 +09:00</time> 版)
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="http://search.cpan.org/dist/Mojo-MySQL5/lib/Mojo/MySQL5/URL.pm">http://search.cpan.org/dist/Mojo-MySQL5/lib/Mojo/MySQL5/URL.pm</anchor-external></figcaption><blockquote><pre class="perl code">  my $url = Mojo::MySQL5::URL-&gt;new('mysql://sri:foo@server:3306/test?foo=bar');</pre></blockquote></figure><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="5" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[5]</anchor-end> 他にも色々バリエーションがあるようです。<figure class="list middle"><ul><li><dfn><code class="URI" xml:lang="en">mysql2:</code></dfn></li><li><dfn><code class="URI" xml:lang="en">mysql+zxjdbc:</code></dfn></li><li><dfn><code class="URI" xml:lang="en">mysql+mysqlconnector:</code></dfn></li><li><dfn><code class="URI" xml:lang="en">mysql+cymysql:</code></dfn></li><li><dfn><code class="URI" xml:lang="en">mysql+pymysql:</code></dfn></li><li><dfn><code class="URI" xml:lang="en">mysql+gaerdbms:</code></dfn></li><li><dfn><code class="URI" xml:lang="en">mysql+pyodbc:</code></dfn></li><li><dfn><code class="URI" xml:lang="en">mysql+mysqldb:</code></dfn></li><li><dfn><code class="URI" xml:lang="en">mysqlgis:</code></dfn></li><li><dfn><code class="URI" xml:lang="en">mysqli:</code></dfn></li></ul></figure></p></section><section><h1>MySQL プロトコル</h1><refs xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:"><ul xmlns="http://www.w3.org/1999/xhtml"><li><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="1" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[1]</anchor-end> <cite xml:lang="en">MySQL :: MySQL Internals Manual :: 14 MySQL Client/Server Protocol</cite> (<time>2014-10-12 05:41:20 +09:00</time> 版) <anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="http://dev.mysql.com/doc/internals/en/client-server-protocol.html">http://dev.mysql.com/doc/internals/en/client-server-protocol.html</anchor-external></li></ul></refs><section><h1><code>caching_sha2_password</code></h1><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="45" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[45]</anchor-end> 
<cite xml:lang="en">MySQL :: MySQL 8.0.4 : New Default Authentication Plugin : caching_sha2_password</cite>, <time>2024-01-19T07:20:48.000Z</time> <anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="https://dev.mysql.com/blog-archive/mysql-8-0-4-new-default-authentication-plugin-caching_sha2_password/">https://dev.mysql.com/blog-archive/mysql-8-0-4-new-default-authentication-plugin-caching_sha2_password/</anchor-external></p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="50" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[50]</anchor-end> 
<cite xml:lang="en">MySQL :: Preparing your Community Connector for MySQL 8 – part 2 – SHA256</cite>, <time>2024-01-23T10:40:20.000Z</time> <anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="https://dev.mysql.com/blog-archive/preparing-your-community-connector-for-mysql-8-part-2-sha256/">https://dev.mysql.com/blog-archive/preparing-your-community-connector-for-mysql-8-part-2-sha256/</anchor-external></p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="46" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[46]</anchor-end> <cite>MySQL: Caching_sha2_password information</cite>, <time>2024-01-19T07:20:59.000Z</time> <anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="https://dev.mysql.com/doc/dev/mysql-server/latest/page_caching_sha2_authentication_exchanges.html">https://dev.mysql.com/doc/dev/mysql-server/latest/page_caching_sha2_authentication_exchanges.html</anchor-external></p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="47" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[47]</anchor-end> 
<cite xml:lang="ja">caching_sha2_passwordの仕様の話 - amamanamam</cite>, <time>2024-01-19T07:21:08.000Z</time> <anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="https://amamanamam.hatenablog.com/entry/2023/11/20/215121">https://amamanamam.hatenablog.com/entry/2023/11/20/215121</anchor-external></p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="48" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[48]</anchor-end> 
<cite>MySQL: Protocol::HandshakeResponse:</cite>, <time>2024-01-19T07:29:14.000Z</time> <anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="https://dev.mysql.com/doc/dev/mysql-server/latest/page_protocol_connection_phase_packets_protocol_handshake_response.html">https://dev.mysql.com/doc/dev/mysql-server/latest/page_protocol_connection_phase_packets_protocol_handshake_response.html</anchor-external></p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="49" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[49]</anchor-end> 
ひたすら面倒になっただけに見えるんだが... これ意味あるのかなあ?</p></section></section><section><h1>SQL</h1><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="41" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[41]</anchor-end> 
<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">GIS</anchor> 系の <anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">SQL</anchor> <anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">関数</anchor>の古いもの (<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">非推奨</anchor>になっていたもの)
は 
<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">MySQL</anchor> 8 で廃止されて削除されて使えなくなってしまったようです。</p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="42" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[42]</anchor-end> 
だいたいは先頭に <code>ST_</code> をつければいいのですが、
<code>GLength</code> は <code>ST_Length</code> になるなど注意が必要なものもあります。</p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="43" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[43]</anchor-end> 
こういう<anchor xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:">非互換変更</anchor>、やめてほしいですね。</p></section><section><h1>メモ</h1><figure class="quote"><figcaption><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="14" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[14]</anchor-end> <cite xml:lang="en">MySQL :: MySQL Connector/J 5.1 Developer Guide :: 5.1 Driver/Datasource Class Names, URL Syntax and Configuration Properties for Connector/J</cite>
(<time>2016-11-17 21:53:23 +09:00</time>)
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="https://dev.mysql.com/doc/connector-j/5.1/en/connector-j-reference-configuration-properties.html">https://dev.mysql.com/doc/connector-j/5.1/en/connector-j-reference-configuration-properties.html</anchor-external></figcaption><blockquote><p>The general format for a JDBC URL for connecting to a MySQL server is as follows, with items in square brackets (<strong>[</strong> <strong>]</strong>) being optional:</p><p>jdbc:mysql://<strong>[</strong>host1<strong>]</strong><strong>[</strong>:port1<strong>]</strong><strong>[</strong>,<strong>[</strong>host2<strong>]</strong><strong>[</strong>:port2<strong>]</strong><strong>]</strong>...<strong>[</strong>/<strong>[</strong>database<strong>]</strong><strong>]</strong> »</p><p><strong>[</strong>?propertyName1=propertyValue1<strong>[</strong>&amp;propertyName2=propertyValue2<strong>]</strong>...<strong>]</strong></p><p>Here is a simple example for a connection URL:</p><p>jdbc:mysql://localhost:3306/sakila?profileSQL=true</p></blockquote></figure><figure class="quote"><figcaption><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="15" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[15]</anchor-end> <cite xml:lang="en">MySQL :: MySQL Connector/J 5.1 Developer Guide :: 5.1 Driver/Datasource Class Names, URL Syntax and Configuration Properties for Connector/J</cite>
(<time>2016-11-17 21:54:08 +09:00</time>)
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="https://dev.mysql.com/doc/connector-j/5.1/en/connector-j-reference-configuration-properties.html">https://dev.mysql.com/doc/connector-j/5.1/en/connector-j-reference-configuration-properties.html</anchor-external></figcaption><blockquote><p>The following is an alternate format for JDBC URLs connecting to a MySQL server, which is mandatory for IPv6 connections, but can also be used with IPv4 (items in square brackets (<strong>[</strong> <strong>]</strong>) are optional):</p><p>jdbc:mysql://address=(key1=value)<strong>[</strong>(key2=value)<strong>]</strong>...<strong>[</strong>,address=(key3=value)<strong>[</strong>(key4=value)<strong>]</strong>...<strong>]</strong>...<strong>[</strong>/<strong>[</strong>database<strong>]</strong><strong>]</strong>»</p><p><strong>[</strong>?propertyName1=propertyValue1<strong>[</strong>&amp;propertyName2=propertyValue2<strong>]</strong>...<strong>]</strong></p><p>Supported key-value pairs include:</p><p>(protocol=tcp), or (protocol=pipe) for named pipes on Windows.</p><p>(path=path_to_pipe) for path of named pipes. Default value for the path is \\.\pipe\MySQL. Use the key-value pair to specify a custom named pipe.</p><p>(host=hostname) for TCP connections.</p><p>(port=port_number) for TCP connections.</p><p>For example:</p><p>jdbc:mysql://address=(protocol=tcp)(host=localhost)(port=3306)/db</p></blockquote></figure><figure class="quote"><figcaption><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="16" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[16]</anchor-end> <cite xml:lang="en">mysqljs/mysql: A pure node.js JavaScript Client implementing the MySql protocol.</cite>
(<time>2016-11-17 21:56:26 +09:00</time>)
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="https://github.com/mysqljs/mysql">https://github.com/mysqljs/mysql</anchor-external></figcaption><blockquote><p>In addition to passing these options as an object, you can also use a url string. For example:</p><p>var connection = mysql.createConnection('mysql://user:pass@host/db?debug=true&amp;charset=BIG5_CHINESE_CI&amp;timezone=-0700');</p><p>Note: The query values are first attempted to be parsed as JSON, and if that fails assumed to be plaintext strings.</p></blockquote></figure><figure class="quote"><figcaption><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="17" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[17]</anchor-end> <cite xml:lang="en">mysql/ConnectionConfig.js at master · mysqljs/mysql</cite>
(<time>2016-11-17 22:00:25 +09:00</time>)
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="https://github.com/mysqljs/mysql/blob/master/lib/ConnectionConfig.js">https://github.com/mysqljs/mysql/blob/master/lib/ConnectionConfig.js</anchor-external></figcaption><blockquote><p>if (url.query) {</p><p>for (var key in url.query) {</p><p>var value = url.query<strong>[</strong>key<strong>]</strong>;</p><p>try {</p><p>// Try to parse this as a JSON expression first</p><p>options<strong>[</strong>key<strong>]</strong> = JSON.parse(value);</p><p>} catch (err) {</p><p>// Otherwise assume it is a plain string</p><p>options<strong>[</strong>key<strong>]</strong> = value;</p><p>}</p><p>}</p><p>}</p></blockquote></figure><figure class="quote"><figcaption><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="18" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[18]</anchor-end> <cite xml:lang="en">Engine Configuration — SQLAlchemy 0.9 Documentation</cite>
(<time>2016-11-05 07:07:26 +09:00</time>)
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="http://docs.sqlalchemy.org/en/rel_0_9/core/engines.html#database-urls">http://docs.sqlalchemy.org/en/rel_0_9/core/engines.html#database-urls</anchor-external></figcaption><blockquote><p># default</p><p>engine = create_engine('mysql://scott:tiger@localhost/foo')</p><p># mysql-python</p><p>engine = create_engine('mysql+mysqldb://scott:tiger@localhost/foo')</p><p># MySQL-connector-python</p><p>engine = create_engine('mysql+mysqlconnector://scott:tiger@localhost/foo')</p><p># OurSQL</p><p>engine = create_engine('mysql+oursql://scott:tiger@localhost/foo')</p></blockquote></figure><figure class="quote"><figcaption><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="19" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[19]</anchor-end> <cite xml:lang="en">MySQL — SQLAlchemy 0.9 Documentation</cite>
(<time>2016-11-05 07:07:26 +09:00</time>)
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="http://docs.sqlalchemy.org/en/rel_0_9/dialects/mysql.html">http://docs.sqlalchemy.org/en/rel_0_9/dialects/mysql.html</anchor-external></figcaption><blockquote><p>mysql+mysqldb://&lt;user&gt;:&lt;password&gt;@&lt;host&gt;[:&lt;port&gt;]/&lt;dbname&gt;</p></blockquote><blockquote><p>mysql+mysqldb://root@/&lt;dbname&gt;?unix_socket=/cloudsql/&lt;projectid&gt;:&lt;instancename&gt;</p></blockquote><blockquote><p>mysql+pymysql://&lt;username&gt;:&lt;password&gt;@&lt;host&gt;/&lt;dbname&gt;[?&lt;options&gt;]</p></blockquote><blockquote><p>mysql+mysqlconnector://&lt;user&gt;:&lt;password&gt;@&lt;host&gt;[:&lt;port&gt;]/&lt;dbname&gt;</p></blockquote><blockquote><p>mysql+cymysql://&lt;username&gt;:&lt;password&gt;@&lt;host&gt;/&lt;dbname&gt;[?&lt;options&gt;]</p></blockquote><blockquote><p>mysql+oursql://&lt;user&gt;:&lt;password&gt;@&lt;host&gt;[:&lt;port&gt;]/&lt;dbname&gt;</p></blockquote><blockquote><p>mysql+mysqldb://root@/&lt;dbname&gt;?unix_socket=/cloudsql/&lt;projectid&gt;:&lt;instancename&gt;</p></blockquote><blockquote><p>mysql+gaerdbms:///&lt;dbname&gt;?instance=&lt;instancename&gt;</p></blockquote><blockquote><p>mysql+pyodbc://&lt;username&gt;:&lt;password&gt;@&lt;dsnname&gt;</p></blockquote><blockquote><p>mysql+zxjdbc://&lt;user&gt;:&lt;password&gt;@&lt;hostname&gt;[:&lt;port&gt;]/&lt;database&gt;</p></blockquote></figure><figure class="quote"><figcaption><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="20" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[20]</anchor-end> <cite xml:lang="en">ClearDB MySQL | Heroku Dev Center</cite>
(<time>2016-11-17 22:19:12 +09:00</time>)
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="https://devcenter.heroku.com/articles/cleardb">https://devcenter.heroku.com/articles/cleardb</anchor-external></figcaption><blockquote><p>You can retrieve your new ClearDB database URL by issuing the following command:</p><p>$ heroku config | grep CLEARDB_DATABASE_URL</p><p>CLEARDB_DATABASE_URL =&gt; mysql://adffdadf2341:adf4234@us-cdbr-east.cleardb.com/heroku_db?reconnect=true</p><p>To set your DATABASE_URL to the value of CLEARDB_DATABASE_URL, simply issue the following heroku command. For example:</p><p>If you’re using the mysql2 gem, you will need to change the mysql:// scheme in the CLEARDB_DATABASE_URL to mysql2://</p></blockquote></figure><figure class="quote"><figcaption><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="21" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[21]</anchor-end> <cite xml:lang="en">ClearDB MySQL | Heroku Dev Center</cite>
(<time>2016-11-17 22:20:25 +09:00</time>)
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="https://devcenter.heroku.com/articles/cleardb">https://devcenter.heroku.com/articles/cleardb</anchor-external></figcaption><blockquote><p>To instantiate a JDBC connection in your code, you can use a method like this:</p><p>private static Connection getConnection() throws URISyntaxException, SQLException {</p><p>URI dbUri = new URI(System.getenv(&quot;CLEARDB_DATABASE_URL&quot;));</p><p>String username = dbUri.getUserInfo().split(&quot;:&quot;)<strong>[</strong>0<strong>]</strong>;</p><p>String password = dbUri.getUserInfo().split(&quot;:&quot;)<strong>[</strong>1<strong>]</strong>;</p><p>String dbUrl = &quot;jdbc:mysql://&quot; + dbUri.getHost() + dbUri.getPath();</p><p>return DriverManager.getConnection(dbUrl, username, password);</p><p>}</p></blockquote></figure><figure class="quote"><figcaption><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="22" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[22]</anchor-end> <cite xml:lang="en">kennethreitz/dj-database-url</cite>
(<time>2015-07-09 00:47:23 +09:00</time> 版)
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="https://github.com/kennethreitz/dj-database-url">https://github.com/kennethreitz/dj-database-url</anchor-external></figcaption><blockquote><p>MySQL (GIS)	django.contrib.gis.db.backends.mysql	mysqlgis://USER:PASSWORD@HOST:PORT/NAME</p></blockquote></figure><figure class="quote"><figcaption><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="23" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[23]</anchor-end> <cite xml:lang="en">julianwachholz/dj-config-url: Use 12factor inspired URLs to configure your Django Application.</cite>
(<time>2016-11-17 22:45:48 +09:00</time>)
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="https://github.com/julianwachholz/dj-config-url">https://github.com/julianwachholz/dj-config-url</anchor-external></figcaption><blockquote><p>MySQL	django.db.backends.mysql	mysql://USER:PASSWORD@HOST:PORT/NAME</p><p>MySQL (GIS)	django.contrib.gis.db.backends.mysql	mysqlgis://USER:PASSWORD@HOST:PORT/NAME</p></blockquote></figure><figure class="quote"><figcaption><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="24" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[24]</anchor-end> <cite xml:lang="en">prometheus/promdash: Prometheus Dashboard Builder</cite>
(<time>2016-11-17 23:18:14 +09:00</time>)
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="https://github.com/prometheus/promdash">https://github.com/prometheus/promdash</anchor-external></figcaption><blockquote><p>DATABASE_URL=&quot;mysql2://username:password@host/database&quot;</p></blockquote></figure><figure class="quote"><figcaption><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="25" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[25]</anchor-end> <cite>java - JDBC MySQL connection using Unix Socket - Stack Overflow</cite>
(<time>2016-11-17 23:47:01 +09:00</time>)
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="http://stackoverflow.com/questions/25918416/jdbc-mysql-connection-using-unix-socket">http://stackoverflow.com/questions/25918416/jdbc-mysql-connection-using-unix-socket</anchor-external></figcaption><blockquote><p>If you want to use UNIX sockets with the Mysql JDBC Connector/J you need to provide a socketFactory.</p><p>jdbc:mysql:///?user=test&amp;password=test&amp;socketFactory=&lt;classname&gt;&amp;&lt;socket&gt;=/tmp/mysql.sock</p><p>So this will vary with the implementation you use. By default, Mysql does not ship with any implementation for that, just provides an example for such a factory in it's source-code.</p></blockquote></figure><figure class="quote"><figcaption><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="26" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[26]</anchor-end> <cite>java - JDBC MySQL connection using Unix Socket - Stack Overflow</cite>
(<time>2016-11-17 23:47:30 +09:00</time>)
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="http://stackoverflow.com/questions/25918416/jdbc-mysql-connection-using-unix-socket">http://stackoverflow.com/questions/25918416/jdbc-mysql-connection-using-unix-socket</anchor-external></figcaption><blockquote><p>As another answer pointed out, it's possible (at least in Intellij IDE) to use socket connection for Mysql JDBC Connector/J (I am using version 5.1) without having to provide a socketFactory,</p><p>jdbc:mysql://localhost:3306/database_name?socket=/tmp/mysql.sock</p></blockquote></figure><figure class="quote"><figcaption><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="27" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[27]</anchor-end> <cite>java - JDBC MySQL connection using Unix Socket - Stack Overflow</cite>
(<time>2016-11-17 23:48:01 +09:00</time>)
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="http://stackoverflow.com/questions/25918416/jdbc-mysql-connection-using-unix-socket">http://stackoverflow.com/questions/25918416/jdbc-mysql-connection-using-unix-socket</anchor-external></figcaption><blockquote><p>The JDBC Driver from the MariaDB project supports Unix domain sockets while remaining compatible with the MySQL Connector/J JDBC driver. Example jdbc url for the MariaDB driver is: jdbc:mariadb://localhost:3306/revmgt?localSocket=/var/run/mysqld/mysqld.sock</p></blockquote></figure><figure class="quote"><figcaption><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="28" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[28]</anchor-end> <cite>Manual :: The Data Source Name</cite>
(<time>2016-11-17 23:52:57 +09:00</time>)
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="http://pear.php.net/manual/en/package.database.db.intro-dsn.php">http://pear.php.net/manual/en/package.database.db.intro-dsn.php</anchor-external></figcaption><blockquote><p>mysql  -&gt; MySQL (for MySQL &lt;= 4.0)</p><p>mysqli -&gt; MySQL (for MySQL &gt;= 4.1) (requires PHP 5) (since DB 1.6.3)</p></blockquote></figure><figure class="quote"><figcaption><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="29" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[29]</anchor-end> <cite>The DB-URI — TurboGears 1.0 documentation</cite>
(<time>2013-01-12 16:52:59 +09:00</time>)
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="http://turbogears.org/1.0/docs/DbUri.html">http://turbogears.org/1.0/docs/DbUri.html</anchor-external></figcaption><blockquote><p>To specify the socket file for MySQL, you need to use the unix_socket option:</p><p>mysql://localhost/database?unix_socket=/var/lib/mysql/socket</p></blockquote></figure><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="37" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[37]</anchor-end> <cite>Client/Server Protocol - MariaDB Knowledge Base</cite>
(<time>2018-08-30 19:21:43 +09:00</time>)
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="https://mariadb.com/kb/en/library/clientserver-protocol/">https://mariadb.com/kb/en/library/clientserver-protocol/</anchor-external></p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="38" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[38]</anchor-end> <cite>library/mariadb - Docker Hub</cite>
(<time>2018-08-30 19:31:01 +09:00</time>)
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="https://hub.docker.com/_/mariadb/">https://hub.docker.com/_/mariadb/</anchor-external></p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="39" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[39]</anchor-end> <cite>mysql - SQLSTATE<strong>[</strong>HY000<strong>]</strong>: General error: 1835 Malformed communication packet on LARAVEL - Stack Overflow</cite>
(<time>2020-11-05T07:47:55.000Z</time>)
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="https://stackoverflow.com/questions/64677836/sqlstatehy000-general-error-1835-malformed-communication-packet-on-laravel">https://stackoverflow.com/questions/64677836/sqlstatehy000-general-error-1835-malformed-communication-packet-on-laravel</anchor-external></p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="40" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[40]</anchor-end> <cite xml:lang="en"><strong>[</strong>MDEV-24121<strong>]</strong> Recent MariaDB update appears to have introduced a DB connection issue for PHP &lt; 7.3 (or anything using PDO) - Jira</cite>
(<time>2020-11-05T07:50:11.000Z</time>)
<anchor-external xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resScheme="URI" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:resParameter="https://jira.mariadb.org/browse/MDEV-24121">https://jira.mariadb.org/browse/MDEV-24121</anchor-external></p><p><anchor-end xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:" a0:anchor="44" xmlns:a0="urn:x-suika-fam-cx:markup:suikawiki:0:9:">[44]</anchor-end> <sw-see xmlns="urn:x-suika-fam-cx:markup:suikawiki:0:9:"> <anchor>MariaDB</anchor> </sw-see></p><blockquote><p>Can't initialize timers</p></blockquote></section></body></html>