{"id":3699,"date":"2020-09-01T01:14:59","date_gmt":"2020-08-31T16:14:59","guid":{"rendered":"https:\/\/okamurax.com\/?p=3699"},"modified":"2021-12-31T04:44:55","modified_gmt":"2021-12-30T19:44:55","slug":"ubuntuindigo-%e5%88%9d%e6%9c%9f%e8%a8%ad%e5%ae%9a","status":"publish","type":"post","link":"https:\/\/appbay.org\/?p=3699","title":{"rendered":"Ubuntu(Indigo) \u521d\u671f\u8a2d\u5b9a"},"content":{"rendered":"<p>Indigo\u306bUbuntu\u3092\u8a2d\u5b9a\uff0b\u30ed\u30fc\u30ab\u30eb\u306b\u3042\u308bSQLite\u3092Indigo\u4e0a\u306eMySQL\u306b\u30a8\u30af\u30b9\u30dd\u30fc\u30c8\u3059\u308b\u5b9f\u9a13\u3002<\/p>\n<h2>\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u751f\u6210<\/h2>\n<p>\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\uff1e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u7ba1\u7406\uff1e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9<br \/>\n\u304b\u3089\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u751f\u6210\u3057\u3001\u8d77\u52d5\u3059\u308b\u3002<\/p>\n<p>\u8868\u793a\u3055\u308c\u3066\u3044\u308bIP\u30a2\u30c9\u30ec\u30b9\u306bTeraTerm\u304b\u3089\u63a5\u7d9a<\/p>\n<blockquote class=\"wp-embedded-content\" data-secret=\"8ENf6kWrHN\"><p><a href=\"https:\/\/appbay.org\/?p=178\">TeraTerm \u8d77\u52d5\u30de\u30af\u30ed<\/a><\/p><\/blockquote>\n<p><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;TeraTerm \u8d77\u52d5\u30de\u30af\u30ed&#8221; &#8212; \u30c6\u30c3\u30af\u30e1\u30e2\" src=\"https:\/\/appbay.org\/?p=178&#038;embed=true#?secret=LYyjs5E405#?secret=8ENf6kWrHN\" data-secret=\"8ENf6kWrHN\" width=\"525\" height=\"296\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/p>\n<h2>SSH\u63a5\u7d9a<\/h2>\n<p>\u516c\u958b\u9375\u65b9\u5f0f\u3067\u306eSSH\u63a5\u7d9a\u3001OS\u3067Ubuntu\u3092\u9078\u629e\u3059\u308b\u3068\u3001\u81ea\u7136\u3068\u30e6\u30fc\u30b6\u30fc\u540d\u306fubuntu\u3068\u306a\u308b\u3002<\/p>\n<p>\u516c\u958b\u9375\u3067\u3001TeraTerm\u3068WinSCP\u3067\u63a5\u7d9a\u3067\u304d\u308b\u3088\u3046\u306b\u8a2d\u5b9a\u3059\u308b\u3002<\/p>\n<blockquote class=\"wp-embedded-content\" data-secret=\"uex7Ag4aoJ\"><p><a href=\"https:\/\/appbay.org\/?p=525\">Ubuntu \u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u95a2\u9023\u8a2d\u5b9a<\/a><\/p><\/blockquote>\n<p><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;Ubuntu \u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u95a2\u9023\u8a2d\u5b9a&#8221; &#8212; \u30c6\u30c3\u30af\u30e1\u30e2\" src=\"https:\/\/appbay.org\/?p=525&#038;embed=true#?secret=SXvfy5Xtf3#?secret=uex7Ag4aoJ\" data-secret=\"uex7Ag4aoJ\" width=\"525\" height=\"296\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/p>\n<h2>MySQL<\/h2>\n<p>\u30fb\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<br \/>\n<span style=\"color: #0000ff;\">sudo apt install mysql-server<\/span><\/p>\n<p>(\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u5f8c\u3001\u8d77\u52d5\uff0b\u81ea\u52d5\u8d77\u52d5\u3059\u308b\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u308b)<\/p>\n<p>\u30fb\u30d0\u30fc\u30b8\u30e7\u30f3\u78ba\u8a8d<br \/>\n<span style=\"color: #0000ff;\">sudo mysql &#8211;version<\/span><\/p>\n<p>\u30fb\u8d77\u52d5\u3001\u4ed6<br \/>\n<span style=\"color: #0000ff;\">sudo systemctl (start|stop|restart|status)\u00a0 mysql<\/span><span style=\"color: #0000ff;\"><br \/>\n<\/span><\/p>\n<p>\u30fbmy.cnf\u3092\u63a2\u3059<br \/>\n<span style=\"color: #0000ff;\">sudo mysql &#8211;help | grep my.cnf<\/span><br \/>\n\u4eca\u56de\u306f<br \/>\n<span style=\"color: #0000ff;\">sudo vim \/etc\/mysql\/mysql.conf.d\/mysqld.cnf<\/span><\/p>\n<p>\u30fb(\u5916\u90e8\u304b\u3089\u63a5\u7d9a\u3059\u308b\u5834\u5408)bind-address\u3092\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\u3002<br \/>\n\u3053\u3053\u3067\u6307\u5b9a\u3057\u305fIP\u30a2\u30c9\u30ec\u30b9\u306e\u307f\u63a5\u7d9a\u3092\u53d7\u3051\u4ed8\u3051\u308b\u3002\u63a5\u7d9a\u5143\u306eIP\u30a2\u30c9\u30ec\u30b9\u304c\u308f\u304b\u308b\u5834\u5408\u306f\u6307\u5b9a\u3057\u3066\u3082\u5927\u4e08\u592b\u3060\u304c\u3001\u8907\u6570\u306eIP\u30a2\u30c9\u30ec\u30b9\u306f\u6307\u5b9a\u3067\u304d\u306a\u3044\u3002<\/p>\n<p>(my.cnf\u3092\u5909\u66f4\u3057\u305f\u5834\u5408\u3001\u518d\u8d77\u52d5)<\/p>\n<p>MySQL\u306eroot\u30a2\u30ab\u30a6\u30f3\u30c8\u306f\u6a19\u6e96\u3067auth_socket\u8a8d\u8a3c\u3057\u3066\u304a\u308a\u3001\u30d1\u30b9\u30ef\u30fc\u30c9\u8a2d\u5b9a\u3057\u3066\u3082\u3001\u30d1\u30b9\u30ef\u30fc\u30c9\u7121\u3057\u3067\u30ed\u30b0\u30a4\u30f3\u3067\u304d\u308b\u3002\u3053\u3053\u3067\u5c11\u3057\u3064\u307e\u3065\u3044\u305f\u3002<br \/>\n(sudo mysql -u root\u3068\u3059\u308c\u3070\u5165\u308c\u308b)<\/p>\n<p>\u30fb\u6587\u5b57\u30b3\u30fc\u30c9\u78ba\u8a8d<br \/>\n<span style=\"color: #0000ff;\">sudo mysql -u root<\/span><br \/>\n<span style=\"color: #0000ff;\">show variables like &#8216;char%&#8217;;<\/span><\/p>\n<pre class=\"lang:default decode:true\">character_set_client     | utf8\r\ncharacter_set_connection | utf8\u00a0\r\ncharacter_set_database   | latin1\u00a0\r\ncharacter_set_filesystem | binary\u00a0\r\ncharacter_set_results    | utf8\u00a0\r\ncharacter_set_server     | latin1\u00a0\r\ncharacter_set_system     | utf8\u00a0\r\ncharacter_sets_dir       | \/usr\/share\/mysql\/charsets\/<\/pre>\n<p><span style=\"color: #0000ff;\"><span style=\"color: #333333;\">\u30fb\u6587\u5b57\u30b3\u30fc\u30c9\u5909\u66f4<\/span><\/span><\/p>\n<p>\u4eca\u306f\u6700\u521d\u304b\u3089utf8mb4\u306b\u306a\u3063\u3066\u3044\u308b\u3002<br \/>\n\u3082\u3057\u306a\u3063\u3066\u3044\u306a\u3044\u5834\u5408\u3001<span style=\"color: #0000ff;\"><span style=\"color: #333333;\">mysqld.cnf\u306b\u4e0b\u8a18\u3092\u8ffd\u52a0\u3059\u308b\u3002<\/span><br \/>\n<\/span><\/p>\n<pre class=\"lang:default decode:true\">[mysqld]\r\ncharacter-set-server = utf8<\/pre>\n<p>\u3053\u308c\u3067\u3001utf8\u306b\u5909\u308f\u308b\u3002<\/p>\n<pre class=\"lang:default decode:true\">character_set_client     | utf8\u00a0\r\ncharacter_set_connection | utf8\u00a0\r\ncharacter_set_database   | utf8\u00a0\r\ncharacter_set_filesystem | binary\u00a0\r\ncharacter_set_results    | utf8\u00a0\r\ncharacter_set_server     | utf8\u00a0\r\ncharacter_set_system     | utf8\u00a0\r\ncharacter_sets_dir       | \/usr\/share\/mysql\/charsets\/<\/pre>\n<p>\u30fbDB\u4f5c\u6210<br \/>\n<span style=\"color: #0000ff;\">sudo mysql -u root<\/span><br \/>\n<span style=\"color: #0000ff;\">create database check_sheet character set utf8mb4;<\/span><\/p>\n<p>\u30fb\u30e6\u30fc\u30b6\u30fc\u4f5c\u6210<\/p>\n<p><span style=\"font-size: 1rem;\">(\u5916\u90e8\u304b\u3089\u63a5\u7d9a\u3059\u308b\u5834\u5408\u30db\u30b9\u30c8\u306f%\u3068\u3057\u3066\u304a\u304f)<br \/>\n<\/span><span style=\"color: #0000ff;\">create user &#8216;app_user&#8217;@&#8217;%&#8217;;<\/span><\/p>\n<p>\u203b\u540c\u6642\u306b\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u8a2d\u5b9a\u3059\u308b\u5834\u5408\u3001<br \/>\n<span style=\"color: #0000ff;\">create user &#8216;app_user&#8217;@&#8217;%&#8217; identified by &#8216;1234&#8217;;<\/span><br \/>\nauth_socket\u8a8d\u8a3c\u3068\u3059\u308b\u5834\u5408\u3001<br \/>\n<span style=\"color: #0000ff;\">create user user@host identified with auth_socket;<\/span><\/p>\n<p>\u30fb\u30e6\u30fc\u30b6\u30fc\u524a\u9664<br \/>\n<span style=\"color: #0000ff;\">drop user &#8216;app_user&#8217;@&#8217;%&#8217;;<\/span><\/p>\n<p>\u30fb\u30e6\u30fc\u30b6\u30fc\u4e00\u89a7<br \/>\n<span style=\"color: #0000ff;\">select user, host, authentication_string, plugin from mysql.user;<\/span><\/p>\n<p>\u30fb\u6a29\u9650\u8a2d\u5b9a<br \/>\n<span style=\"color: #0000ff;\">grant create,drop,alter,select,insert,update,delete on check_sheet.* to &#8216;app_user&#8217;@&#8217;%&#8217;;<\/span><\/p>\n<p>\u3053\u308c\u3092\u5b9f\u884c\u3057\u306a\u3044\u3068\u4f5c\u6210\u3057\u305f\u30e6\u30fc\u30b6\u30fc\u3067DB\u304c\u64cd\u4f5c\u3067\u304d\u306a\u3044\u3002<\/p>\n<p>\u30fb\u6a29\u9650\u78ba\u8a8d<br \/>\n<span style=\"color: #0000ff;\">show grants for &#8216;app_user&#8217;@&#8217;%&#8217;;<\/span><\/p>\n<p>\u30fb\u6a29\u9650\u524a\u9664<br \/>\n<span style=\"color: #0000ff;\">revoke all, grant option from &#8216;app_user&#8217;@&#8217;%&#8217;;<\/span><\/p>\n<p>\u30fb\u30d1\u30b9\u30ef\u30fc\u30c9\u8a2d\u5b9a<\/p>\n<p>\u30b7\u30a7\u30eb\u304b\u3089\u30ef\u30f3\u30e9\u30a4\u30ca\u30fc\u306e\u5834\u5408<br \/>\n<span style=\"color: #0000ff;\">pass=$(head \/dev\/urandom | tr -dc a-km-np-z1-9 | head -c 13); sudo mysql -u root -e &#8220;alter user &#8216;app_user&#8217;@&#8217;%&#8217; identified by &#8216;${pass}'&#8221;; echo $pass;<\/span><\/p>\n<p>\u3042\u308b\u3044\u306f\u3001<br \/>\n<span style=\"color: #0000ff;\">alter user &#8216;app_user&#8217;@&#8217;%&#8217; identified by &#8216;2345&#8217;;<\/span><br \/>\n<span style=\"color: #0000ff;\">set password for &#8216;app_user&#8217;@&#8217;%&#8217; = &#8216;2345&#8217;;<br \/>\n<\/span><\/p>\n<h2>MySQL SSL\u63a5\u7d9a<\/h2>\n<p>\u30fb\u72b6\u614b\u78ba\u8a8d<br \/>\n<span style=\"color: #0000ff;\">show variables like &#8216;%ssl%&#8217;;<\/span><\/p>\n<pre class=\"lang:default decode:true\">have_openssl | YES\r\nhave_ssl     | YES\r\nssl_ca       | ca.pem\r\nssl_capath\r\nssl_cert     | server-cert.pem\r\nssl_cipher\r\nssl_crl\r\nssl_crlpath\r\nssl_key<\/pre>\n<p>\u521d\u56de\u8d77\u52d5\u6642\u306b\u3001mysql_ssl_rsa_setup()\u304c\u5b9f\u884c\u3055\u308c\u3001\u3053\u306e\u3088\u3046\u306bSSL\u304c\u6709\u52b9\u306b\u306a\u3063\u3066\u3044\u305f\u3002MySQL\u306e\u30c7\u30fc\u30bf\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u4ee5\u4e0b\u306b\u751f\u6210\u3055\u308c\u308b\u3002<\/p>\n<p>ca.pem\uff1a\u81ea\u5df1\u7f72\u540dCA\u8a3c\u660e\u66f8<br \/>\nca-key.pem\uff1aCA\u79d8\u5bc6\u9375<br \/>\nserver-cert.pem\uff1a\u30b5\u30fc\u30d0\u7528\u516c\u958b\u9375<br \/>\nserver-key.pem\uff1a\u30b5\u30fc\u30d0\u7528\u79d8\u5bc6\u9375<br \/>\nclient-cert.pem\uff1a\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u7528\u516c\u958b\u9375<br \/>\nclient-key.pem\uff1a\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u7528\u79d8\u5bc6\u9375<br \/>\nprivate_key.pem\uff1acaching_sha2_password, sha256_password\u7528\u79d8\u5bc6\u9375<br \/>\npublic_key.pem\uff1acaching_sha2_password, sha256_password\u7528\u516c\u958b\u9375<\/p>\n<p>\u30fb\u30c7\u30fc\u30bf\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u78ba\u8a8d<br \/>\n<span style=\"color: #0000ff;\">show variables like &#8216;%datadir%&#8217;;<\/span><\/p>\n<p>(\u5f8c\u306e\u30b3\u30d4\u30fc\u3067\u3082\u5fc5\u8981\u306a\u306e\u3067\u3001\u3053\u3053\u3067\u5b9f\u884c)<br \/>\npermission denied\u3068\u306a\u308b\u306e\u3067\u3001<br \/>\n<span style=\"color: #0000ff;\">sudo su<br \/>\n<\/span>\u3092\u5b9f\u884c\u3059\u308b\u3002<\/p>\n<p>\u30fb\u30c7\u30fc\u30bf\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u79fb\u52d5<br \/>\n<span style=\"color: #0000ff;\">cd \/var\/lib\/mysql<\/span><\/p>\n<p>\u30fb\u30b3\u30d4\u30fc\uff0b\u30d1\u30fc\u30df\u30c3\u30b7\u30e7\u30f3\u5909\u66f4<\/p>\n<p>\u30c7\u30fc\u30bf\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u304b\u3089\u3001<br \/>\n<span style=\"color: #0000ff;\">client-cert.pem<\/span><br \/>\n<span style=\"color: #0000ff;\">client-key.pem<\/span><br \/>\n<span style=\"color: #0000ff;\">ca.pem (\u5fc5\u8981\u306a\u3089)<\/span><br \/>\n\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308b\u305f\u3081\u3001\u5148\u305a\u30db\u30fc\u30e0\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u30b3\u30d4\u30fc\u3059\u308b\u3002<br \/>\n(\u3053\u308c\u3089\u306e\u30d5\u30a1\u30a4\u30eb\u306fWorkbech\u3067\u5229\u7528\u3059\u308b\u3051\u3069\u3001\u3082\u3057C#\u3060\u3051\u306a\u3089\u3001\u305d\u306e\u307e\u307e\u5909\u63db\u3059\u308b\u306e\u3067\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u4e0d\u8981)<\/p>\n<p>\u4eca\u56de\u306f\/var\/lib\/mysql\/\u306b\u3042\u3063\u305f\u306e\u3067\u3001\u30b3\u30d4\u30fc\u3059\u308b\u3002<br \/>\n<span style=\"color: #0000ff;\">cp \/var\/lib\/mysql\/client-cert.pem \/home\/ubuntu\/client-cert.pem;<br \/>\n<\/span><span style=\"color: #0000ff;\">cp \/var\/lib\/mysql\/client-key.pem \/home\/ubuntu\/client-key.pem;<br \/>\ncp \/var\/lib\/mysql\/ca.pem \/home\/ubuntu\/ca.pem<\/span><\/p>\n<p>\u30fb\u30d1\u30fc\u30df\u30c3\u30b7\u30e7\u30f3\u5909\u66f4<\/p>\n<p>\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308b\u306e\u306b\u30d1\u30fc\u30df\u30c3\u30b7\u30e7\u30f3\u5909\u66f4\u304c\u5fc5\u8981\u306a\u306e\u3067\u3001\u30db\u30fc\u30e0\u30c7\u30a3\u30ec\u30af\u30c8\u30ea(\u30b3\u30d4\u30fc\u5148)\u306b\u79fb\u52d5\u3057\u3001<br \/>\n<span style=\"color: #0000ff;\">chmod go+r ca.pem;<br \/>\nchmod go+r client-key.pem;<br \/>\nchmod go+r client-cert.pem<\/span><br \/>\n\u306e\u3088\u3046\u306b\u3059\u308b\u3002<\/p>\n<p>\u3053\u308c\u3067WinSCP\u306a\u3069\u3067\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3067\u304d\u308b\u3002<\/p>\n<p>\u30fb\u30e6\u30fc\u30b6\u30fc\u623b\u3059<br \/>\n<span style=\"color: #0000ff;\">su ubuntu<\/span><\/p>\n<p>\u30fbSSL\u306e\u30e6\u30fc\u30b6\u30fc\u72b6\u614b\u78ba\u8a8d<br \/>\n<span style=\"color: #0000ff;\">select user,host,ssl_type from mysql.user;<\/span><\/p>\n<p>ssl_type\u306e\u90e8\u5206\u3092\u78ba\u8a8d\u3059\u308b\u3002<\/p>\n<p>\u30fb\u6a29\u9650\u8ffd\u52a0<span style=\"color: #0000ff;\"><br \/>\nalter user &#8216;app_user&#8217;@&#8217;%&#8217; require X509;<br \/>\n<\/span><\/p>\n<p>\u30fb\u5168\u3066\u306e\u6a29\u9650\u3092\u524a\u9664<br \/>\n<span style=\"color: #0000ff;\">revoke all, grant option from &#8216;app_user&#8217;@&#8217;%&#8217;;<\/span><\/p>\n<p>require\u3067\u6307\u5b9a\u3059\u308b\u30aa\u30d7\u30b7\u30e7\u30f3\u306b\u3064\u3044\u3066<\/p>\n<p>\u30fbSSL<br \/>\n\u6697\u53f7\u5316\u63a5\u7d9a\u306f\u30b5\u30fc\u30d0\u30fc\u306ecert,key\u306e\u307f\u306a\u306e\u3067\u3001\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u306ecert,key\u306f\u6307\u5b9a\u3057\u306a\u304f\u3066\u3082\u5927\u4e08\u592b\u3002<\/p>\n<p>\u30fbX509<br \/>\n\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u3092\u8a3c\u660e\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u305f\u3081\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u306bcert,key\u3092\u6307\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u3002<\/p>\n<p>\u3053\u3053\u306e\u6307\u5b9a\u3068\u306f\u5225\u306b\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u5074\u304b\u3089\u3082\u30aa\u30d7\u30b7\u30e7\u30f3\u304c\u3042\u308b\u3002<\/p>\n<p>\u30fbDISABLED<br \/>\n\u30fbPREFERRED (default)<br \/>\n\u30b5\u30fc\u30d0\u304c\u6697\u53f7\u5316\u63a5\u7d9a\u3092\u30b5\u30dd\u30fc\u30c8\u3057\u3066\u3044\u308b\u5834\u5408\u306f\u6697\u53f7\u5316\u63a5\u7d9a\u3002\u63a5\u7d9a\u3067\u304d\u306a\u3044\u5834\u5408\u306f\u901a\u5e38\u306e\u63a5\u7d9a\u3002<br \/>\n\u30fbREQUIRED<br \/>\n\u30b5\u30fc\u30d0\u30fc\u8a8d\u8a3c\u3092\u884c\u306a\u3063\u3066\u63a5\u7d9a\u3059\u308b\u3002<br \/>\n\u30fbVERIFY_CA<br \/>\n\u30b5\u30fc\u30d0\u30fc\u8a8d\u8a3c\u3068\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u8a8d\u8a3c\u3092\u884c\u3063\u3066\u63a5\u7d9a\u3059\u308b\u3002<\/p>\n<h2>MySQL \u5916\u90e8\u304b\u3089\u306e\u63a5\u7d9a<\/h2>\n<p>IP\u30a2\u30c9\u30ec\u30b9\u306e\u6307\u5b9a\u304c\u306a\u3044\u3001\u307e\u305f\u306fIP\u30a2\u30c9\u30ec\u30b9\u306e\u6307\u5b9a\u3092\u3057\u305f\u3044\u304c\u56fa\u5b9a\u3067\u306f\u306a\u3044\u5834\u5408\u3001MySQL\u306ebind-address\u306f\u8907\u6570\u6307\u5b9a\u3067\u304d\u305a\u3001\u30e6\u30fc\u30b6\u30fc\u306e\u30db\u30b9\u30c8\u90e8\u3092\u983b\u7e41\u306b\u5909\u66f4\u3059\u308b\u306e\u3082\u624b\u9593\u306a\u306e\u3067ufw\u3067\u5f3e\u304f\u306e\u304c\u7c21\u5358\u3002<\/p>\n<p><span style=\"color: #0000ff;\">sudo ufw allow 3306\/tcp<br \/>\nsudo ufw reload<\/span><\/p>\n<p>\u3082\u3057IP\u30a2\u30c9\u30ec\u30b9\u3092\u6307\u5b9a\u3057\u305f\u3044\u5834\u5408<\/p>\n<p><span style=\"color: #0000ff;\">sudo ufw allow from IP\u30a2\u30c9\u30ec\u30b9 to any port 3306 proto tcp<\/span><br \/>\n\u3053\u308c\u3067\u3001\u7279\u5b9a\u306eIP\u306e\u307fMySQL\u306b\u63a5\u7d9a\u3067\u304d\u308b\u3002<\/p>\n<p>IP\u30a2\u30c9\u30ec\u30b9\u304c\u5909\u66f4\u306b\u306a\u3063\u305f\u3089\u3001<br \/>\n<span style=\"color: #0000ff;\">sudo ufw status numbered<\/span><br \/>\n\u3067No\u3092\u78ba\u8a8d\u3057\u3001<br \/>\n<span style=\"color: #0000ff;\">sudo ufw delete \u756a\u53f7<\/span><br \/>\n(\u8907\u6570\u4e0d\u53ef)<br \/>\n\u3067\u8a72\u5f53\u30eb\u30fc\u30eb\u3092\u524a\u9664\u3057\u3001\u518d\u5ea6\u3001<br \/>\n<span style=\"color: #0000ff;\">sudo ufw allow from IP\u30a2\u30c9\u30ec\u30b9 to any port 3306 proto tcp<\/span><br \/>\n\u3067\u5909\u66f4\u5f8c\u306eIP\u30a2\u30c9\u30ec\u30b9\u3092\u6307\u5b9a\u3059\u308b\u3002<\/p>\n<h2>Apache+PHP<\/h2>\n<p>\u4eca\u56de\u306f\u5229\u7528\u3057\u306a\u3044\u3002<\/p>\n<blockquote class=\"wp-embedded-content\" data-secret=\"WxRvd3nChK\"><p><a href=\"https:\/\/appbay.org\/?p=1133\">Ubuntu Apache(PHP+MySQL) \u8a2d\u5b9a<\/a><\/p><\/blockquote>\n<p><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;Ubuntu Apache(PHP+MySQL) \u8a2d\u5b9a&#8221; &#8212; \u30c6\u30c3\u30af\u30e1\u30e2\" src=\"https:\/\/appbay.org\/?p=1133&#038;embed=true#?secret=aOPaxsElFX#?secret=WxRvd3nChK\" data-secret=\"WxRvd3nChK\" width=\"525\" height=\"296\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/p>\n<h2>\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u8a2d\u5b9a<\/h2>\n<blockquote class=\"wp-embedded-content\" data-secret=\"AUYLWAfykO\"><p><a href=\"https:\/\/appbay.org\/?p=3768\">GCP Cloud SQL(MySQL) \u4f7f\u3044\u65b9<\/a><\/p><\/blockquote>\n<p><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;GCP Cloud SQL(MySQL) \u4f7f\u3044\u65b9&#8221; &#8212; \u30c6\u30c3\u30af\u30e1\u30e2\" src=\"https:\/\/appbay.org\/?p=3768&#038;embed=true#?secret=qzPxL3hFkZ#?secret=AUYLWAfykO\" data-secret=\"AUYLWAfykO\" width=\"525\" height=\"296\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><\/p>\n<h2>SQLite\u3092MySQL\u3078\u30a8\u30af\u30b9\u30dd\u30fc\u30c8<\/h2>\n<p>\u3068\u308a\u3042\u3048\u305a\u52d5\u304b\u3059\u305f\u3081\u3060\u3051\u306e\u8a2d\u5b9a\u3067\u5b9f\u969b\u306f\u7d30\u304b\u304f\u8abf\u6574\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b<\/p>\n<p>DB Browser for SQLite\u306b\u3066\u3001<br \/>\n<span style=\"color: #0000ff;\">\u30d5\u30a1\u30a4\u30eb\uff1e\u30a8\u30af\u30b9\u30dd\u30fc\u30c8\uff1e\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092SQL\u30d5\u30a1\u30a4\u30eb\u3078<\/span><\/p>\n<p><span style=\"color: #0000ff;\">\u30fbinsert into \u306b\u30ab\u30e9\u30e0\u540d\u3092\u4fdd\u6301<\/span><br \/>\n<span style=\"color: #0000ff;\">\u30fbinsert\u6587\u306b\u8907\u6570\u884c(VALUES)<\/span><br \/>\n\u306b\u30c1\u30a7\u30c3\u30af\u3002<\/p>\n<p><span style=\"color: #0000ff;\">\u30fb\u3059\u3079\u3066\u3092\u30a8\u30af\u30b9\u30dd\u30fc\u30c8<\/span><br \/>\n<span style=\"color: #0000ff;\">\u30fb\u53e4\u3044\u30b9\u30ad\u30fc\u30de\u3092\u4e0a\u66f8\u304d(DROP TABLE \u3057\u305f\u5f8c\u306b CREATE TABLE)<\/span><br \/>\n\u3092\u9078\u629e\u3057\u3066\u4fdd\u5b58\u3002(DROP\u3057\u306a\u3044\u3068\u4f55\u5ea6\u304b\u5b9f\u884c\u3059\u308b\u3068\u304d\u306b\u4f5c\u6210\u6e08\u307f\u306e\u30c6\u30fc\u30d6\u30eb\u304c\u6b8b\u3063\u305f\u308a\u3059\u308b)<\/p>\n<p>\u305d\u308c\u305e\u308c\u30c7\u30fc\u30bf\u306e\u5185\u5bb9\u306b\u3088\u3063\u3066\u9055\u3046\u304c\u4eca\u56de\u306f\u66f8\u304d\u51fa\u3057\u305fSQL\u30d5\u30a1\u30a4\u30eb\u3092\u4e0b\u8a18\u306e\u901a\u308a\u4fee\u6b63\u3002<\/p>\n<p><span style=\"color: #0000ff;\">\u30fb\u5148\u982d\u306eBIGIN TRANSACTION\u3092START TRANSACTION\u306b\u5909\u66f4\u3002<\/span><\/p>\n<p><span style=\"color: #0000ff;\">\u30fb\u5168\u3066\u306e\u30c0\u30d6\u30eb\u30af\u30a9\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u306e\u524a\u9664\u3002<br \/>\n<\/span>\u30c6\u30fc\u30d6\u30eb\u540d\u3084\u30ab\u30e9\u30e0\u540d\u304c\u30c0\u30d6\u30eb\u30af\u30a9\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u3067\u56f2\u308f\u308c\u3066\u3044\u308b\u305f\u3081\u3002<\/p>\n<p><span style=\"color: #0000ff;\">\u30fbCREATE TABLE\u3067\u578b\u304c\u629c\u3051\u3066\u3044\u308b\u90e8\u5206\u306btext\u3092\u8ffd\u52a0\u3002<\/span><\/p>\n<p><span style=\"color: #0000ff;\">\u30fb\u5168\u3066\u306e\u578b\u3092text\u306b\u5909\u66f4\u3002<br \/>\n<\/span>insert\u306e\u90e8\u5206\u3067int\u7b49\u3082\u7a7a\u306e\u90e8\u5206\u304c\u30b7\u30f3\u30b0\u30eb\u30af\u30a9\u30fc\u30c6\u30fc\u30b7\u30e7\u30f3\u306b\u306a\u3063\u3066\u3044\u308b\u305f\u3081<\/p>\n<p><span style=\"color: #0000ff;\">\u30fbPRIMARY KEY()\u3092\u524a\u9664\u3002<\/span><br \/>\n\u4e0a\u306e\u884c\u672b\u306e\u30ab\u30f3\u30de\u3082\u524a\u9664<\/p>\n<p>\u30d5\u30a1\u30a4\u30eb\u30b5\u30a4\u30ba\u304c\u5927\u304d\u3044\u306e\u3067\u3001WinSCP\u3067\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3057\u3001<br \/>\n<span style=\"color: #0000ff;\">mysql -u root -p db\u540d &lt; SQL\u30d5\u30a1\u30a4\u30eb.sql<\/span><br \/>\n\u3068\u3057\u3066\u5b9f\u884c\u3002<br \/>\n\u203b\u3061\u306a\u307f\u306b\u3001\u30a8\u30af\u30b9\u30dd\u30fc\u30c8\u306f\u3001<br \/>\n<span style=\"color: #0000ff;\">mysqldump &#8211;single-transaction -u \u30e6\u30fc\u30b6\u540d DB\u540d &gt; \u51fa\u529b\u5148\u30d5\u30a1\u30a4\u30eb\u540d<\/span><\/p>\n<p>Workbench\u306e\u5834\u5408\u3001<br \/>\n<span style=\"color: #0000ff;\">Server\uff1eData Import\uff1eImport from Self-Contained File<br \/>\n<\/span>Default Target Schema\u304b\u3089\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u540d\u3092\u9078\u629e\u3057Start Import\u3092\u5b9f\u884c\u3002<\/p>\n<p>ERROR 2006 (HY000) at line 1820: MySQL server has gone away<br \/>\nOperation failed with exitcode 1<\/p>\n<p>\u3068\u3044\u3046\u30a8\u30e9\u30fc\u304c\u3067\u305f\u5834\u5408\u3001<br \/>\n<span style=\"color: #0000ff;\">set global max_allowed_packet = 16777216;<\/span><br \/>\n(\u4e00\u6642\u7684)<\/p>\n<p>\u30a4\u30f3\u30dd\u30fc\u30c8\u5f8c\u306b\u30ab\u30e9\u30e01\u3064\u305a\u3064\u30c7\u30fc\u30bf\u578b\u3092\u5909\u66f4\u3059\u308b\u3002<br \/>\n<span style=\"color: #0000ff;\">alter table table_name modify column_name int not null primary key auto_increment;<\/span><br \/>\n\u306e\u3088\u3046\u306b\u51e6\u7406\u3057\u3001<br \/>\nint\u306b\u95a2\u3057\u3066\u306f\u3001SQLite\u3067\u7a7a\u6587\u5b57\u304c\u5165\u3063\u3066\u3057\u307e\u3063\u3066\u3044\u308b\u3068\u30a8\u30e9\u30fc\u304c\u3067\u308b\u306e\u3067\u3001<br \/>\n<span style=\"color: #0000ff;\">update table_name set column_name = null where column_name = &#8220;&#8221;;<\/span><br \/>\n\u3053\u306e\u3088\u3046\u306b\u3057\u305f\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Indigo\u306bUbuntu\u3092\u8a2d\u5b9a\uff0b\u30ed\u30fc\u30ab\u30eb\u306b\u3042\u308bSQLite\u3092Indigo\u4e0a\u306eMySQL\u306b\u30a8\u30af\u30b9\u30dd\u30fc\u30c8\u3059\u308b\u5b9f\u9a13\u3002 \u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u751f\u6210 \u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\uff1e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u7ba1\u7406\uff1e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9 \u304b\u3089\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u751f\u6210\u3057\u3001\u8d77\u52d5\u3059\u308b\u3002 \u8868\u793a &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/appbay.org\/?p=3699\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;Ubuntu(Indigo) \u521d\u671f\u8a2d\u5b9a&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[145,13],"class_list":["post-3699","post","type-post","status-publish","format-standard","hentry","category-1","tag-linux","tag-mysql-mariadb"],"_links":{"self":[{"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts\/3699","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3699"}],"version-history":[{"count":48,"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts\/3699\/revisions"}],"predecessor-version":[{"id":4710,"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts\/3699\/revisions\/4710"}],"wp:attachment":[{"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3699"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3699"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3699"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}