{"id":313,"date":"2017-07-06T21:00:23","date_gmt":"2017-07-06T12:00:23","guid":{"rendered":"https:\/\/iwako.pgw.jp\/?p=313"},"modified":"2022-12-21T12:11:33","modified_gmt":"2022-12-21T03:11:33","slug":"%e5%a4%96%e9%83%a8%e3%81%aemysql%e3%82%b5%e3%83%bc%e3%83%90%e3%83%bc%e3%81%ab%e6%8e%a5%e7%b6%9a%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/iwako.pgw.jp\/?p=313","title":{"rendered":"\u5916\u90e8\u306emysql\u30b5\u30fc\u30d0\u30fc\u306b\u63a5\u7d9a\u3059\u308b"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/iwako.pgw.jp\/wp-content\/uploads\/2017\/07\/mysqlImg.png\" alt=\"mysqlImg\" width=\"900\" height=\"467\" class=\"alignnone size-full wp-image-315\" srcset=\"https:\/\/iwako.pgw.jp\/wp-content\/uploads\/2017\/07\/mysqlImg.png 900w, https:\/\/iwako.pgw.jp\/wp-content\/uploads\/2017\/07\/mysqlImg-300x156.png 300w, https:\/\/iwako.pgw.jp\/wp-content\/uploads\/2017\/07\/mysqlImg-768x399.png 768w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><br \/>\n\u7532raspberrypi\u306b\u3042\u308bmysql\u30b5\u30fc\u30d0\u30fc\u3092\u3001<br \/>\n\u4e59raspberrypi\u304b\u3089\u64cd\u4f5c\u3057\u305f\u3044\u3068\u3044\u3046\u306e\u304c\u52d5\u6a5f\u3002<br \/>\n\u4eca\u56d8\u306f\u540c\u4e00\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u304b\u3089\u306e\u8a66\u884c\u3067\u306f\u3042\u308b\u304c\u3001<br \/>\n\u5916\u90e8\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u304b\u3089\u3067\u3082\u57fa\u672c\u306f\u540c\u3058\u3060\u308d\u3046\u3002<br \/>\n\u591a\u5206\u2026\u3002<\/p>\n<p>\u30fbmy.conf\u3092\u7de8\u96c6\u3059\u308b<br \/>\n$ sudo vim \/etc\/mysql\/my.cnf<br \/>\nbind-address=127.0.0.1<br \/>\n\u3092\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\u3059\u308b\u3002<br \/>\n#bind-address=127.0.0.1<br \/>\n\u8ffd\u8a18\u3059\u308b\u3068\u826f\u3044\u3068\u3044\u3046\u3075\u3046\u306b\u3057\u3066\u3044\u308b\u3068\u3053\u308d\u3082\u3042\u308b\u304c\u3001\u305d\u308c\u3060\u3068\u3046\u307e\u304f\u3044\u304b\u306a\u304b\u3063\u305f\u306e\u3067\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\u306e\u307f\u306b\u3057\u3066\u3044\u308b\u3002<\/p>\n<p>\u30fb\u30e6\u30fc\u30b6\u30fc\u3092\u4f5c\u6210\u3059\u308b<br \/>\n\u5916\u90e8\u63a5\u7e8c\u7528\u306e\u30e6\u30fc\u30b6\u30fc\u3092\u4f5c\u6210\u30fb\u8a2d\u5b9a\u3059\u308b\u3002<br \/>\nmysql> create user \u201cUSERNAME\u201d@\u201cHOSTNAME\u201d identified by \u201cPASSWD\u201d;<br \/>\n\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u8b8a\u66f4\u306e\u6b0a\u9650\u4ed8\u8207\u3002<br \/>\nmysql> grant all privileges on DB.TABLE to \u201cUSERNAME\u201d@\u201cHOSTNAME\u201d;<\/p>\n<p>\u30fbmysql\u306e\u518d\u8d77\u52d5<br \/>\nsudo service mysql restart<br \/>\n\tdeamon\u304c\u52d5\u3044\u3066\u3044\u308b\u304b\u78ba\u8a8d\u3059\u308b\u3002<br \/>\n\t$ ps aux | grep mysqld<\/p>\n<p>\u30fbmysql\u6b0a\u9650\u306e\u78ba\u8a8d\u30fb\u4ed8\u8207\u30fb\u524a\u9664<br \/>\n\u30e6\u30fc\u30b6\u30fc\u306e\u4e00\u89bd\u8868\u793a<br \/>\nmysql> use mysql<br \/>\nmysql> select user,host from user;<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;+<br \/>\n| user             | host          |<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;+<br \/>\n| root             | 127.0.0.1     |<br \/>\n| root             | ::1           |<br \/>\n| root             | localhost     |<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;+<br \/>\n\u6b0a\u9650\u306e\u78ba\u8a8d<br \/>\nmysql> show grants for \u201cUSERNAME\u201d@\u201cHOSTNAME\u201d<br \/>\n\u6b0a\u9650\u306e\u4ed8\u8207<br \/>\nmysql> grant all provileges on DBNAME.TABLE to \u201cUSERNAME\u201d@\u201cHOSTNAME\u201d;<br \/>\n\u6b0a\u9650\u306e\u524a\u9664<br \/>\nmysql> revoke all on DBNAME.* \u201cUSERNAME\u201d@\u201cHOSTNAME\u201d;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7532raspberrypi\u306b\u3042\u308bmysql\u30b5\u30fc\u30d0\u30fc\u3092\u3001 \u4e59raspberrypi\u304b\u3089\u64cd\u4f5c\u3057\u305f\u3044\u3068\u3044\u3046\u306e\u304c\u52d5\u6a5f\u3002 \u4eca\u56d8\u306f\u540c\u4e00\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u304b\u3089\u306e\u8a66\u884c\u3067\u306f\u3042\u308b\u304c\u3001 \u5916\u90e8\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u304b\u3089\u3067\u3082\u57fa\u672c\u306f\u540c\u3058\u3060\u308d\u3046\u3002 \u591a\u5206\u2026\u3002 \u30fbmy.c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-313","post","type-post","status-publish","format-standard","hentry","category-web"],"_links":{"self":[{"href":"https:\/\/iwako.pgw.jp\/index.php?rest_route=\/wp\/v2\/posts\/313","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/iwako.pgw.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/iwako.pgw.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/iwako.pgw.jp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/iwako.pgw.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=313"}],"version-history":[{"count":2,"href":"https:\/\/iwako.pgw.jp\/index.php?rest_route=\/wp\/v2\/posts\/313\/revisions"}],"predecessor-version":[{"id":316,"href":"https:\/\/iwako.pgw.jp\/index.php?rest_route=\/wp\/v2\/posts\/313\/revisions\/316"}],"wp:attachment":[{"href":"https:\/\/iwako.pgw.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=313"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/iwako.pgw.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=313"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/iwako.pgw.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=313"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}