{"id":9659,"date":"2022-06-12T05:39:47","date_gmt":"2022-06-11T20:39:47","guid":{"rendered":"https:\/\/www.stuffy.site\/computers\/?p=9659"},"modified":"2022-06-12T08:52:09","modified_gmt":"2022-06-11T23:52:09","slug":"php%e6%8e%b2%e7%a4%ba%e6%9d%bf%e3%82%a8%e3%83%a9%e3%83%bc-mysqli-hy000-2002-permission-denied","status":"publish","type":"post","link":"https:\/\/www.stuffy.site\/computers\/archives\/9659","title":{"rendered":"PHP\u63b2\u793a\u677f\u30a8\u30e9\u30fc mysqli(): (HY000\/2002): Permission denied"},"content":{"rendered":"\n<p>\u4eca\u56de\u3082 <a href=\"https:\/\/gray-code.com\/php\/make-the-board-vol12\/\">\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u304b\u3089\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3059\u308b | GRAYCODE PHP\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0<\/a> \u304b\u3089phpMyAdmin\u3067PHP\u63b2\u793a\u677f\u3092\u4f5c\u6210\u3057\u3066\u3044\u305f\u3068\u3053\u308d\u3001\u306a\u306b\u3084\u3089\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u63a5\u7d9a\u3067\u304d\u306a\u3044\u30a8\u30e9\u30fc\u3092\u3081\u3082\u3002<\/p>\n\n\n\n<!--more-->\n\n\n\n<p>MySQL\u3067\u30e6\u30fc\u30b6\u30fc\u3092\u4f5c\u6210\u3057\u305f\u306e\u3061phpMyAdmin\u3067\u30e6\u30fc\u30b6\u30fc\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u4f5c\u6210\u3057\u305f\u3082\u306e\u306ePHP\u63b2\u793a\u677f\u304b\u3089\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u63a5\u7d9a\u3067\u304d\u307e\u305b\u3093\u3002<\/p>\n\n\n<pre style=\"background-color: #000000; color: #ffffff;\"># mysql -u root -p\nmysql&gt; <span style=\"color: #00ff00;\">grant all privileges on board.* to board@\"%\" identified by '\u30e6\u30fc\u30b6\u30fc\u30d1\u30b9\u30ef\u30fc\u30c9';<\/span>\nmysql&gt; <span style=\"color: #00ff00;\">flush privileges;<\/span><\/pre>\n\n\n<p>\u305d\u3093\u306a\u3068\u304d\u306fSELinux\u304c\u539f\u56e0\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002getsebool \u3067\u78ba\u8a8d\u3057\u3066\u307f\u3066 httpd_can_network_connect_db \u304c Off \u3060\u3063\u305f\u3068\u304d\u306f\u3001setsebool\u30b3\u30de\u30f3\u30c9\u3067\u30d6\u30fc\u30ea\u30a2\u30f3\u5024\u3092 On \u306b\u3059\u308b\u3068\u826f\u3044\u3088\u3046\u3067\u3059\u3002<\/p>\n\n\n<pre style=\"font-size: 14pt;\"># getsebool httpd_can_network_connect_db\nhttpd_can_network_connect_db --&gt; off\n\n# setsebool -P httpd_can_network_connect_db 1<\/pre>\n\n\n<p>\u53c2\u8003URL\uff1a<a href=\"https:\/\/dev.classmethod.jp\/articles\/redhat-selinx-might-block-network-connection-to-servers-from-apache-php\/\">RedHat\u3067PHP\u304b\u3089DB\u30b5\u30fc\u30d0\u306b\u63a5\u7d9a\u3067\u304d\u306a\u3044\u3068\u304d\u306fSELinux\u306e\u8a2d\u5b9a\u304c\u539f\u56e0\u304b\u3082?<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4eca\u56de\u3082 \u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u304b\u3089\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3059\u308b | GRAYCODE PHP\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0 \u304b\u3089phpMyAdmin\u3067PHP\u63b2\u793a\u677f\u3092\u4f5c\u6210\u3057\u3066\u3044\u305f\u3068\u3053\u308d\u3001\u306a\u306b\u3084\u3089\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u63a5\u7d9a\u3067\u304d\u306a\u3044\u30a8\u30e9\u30fc\u3092\u3081\u3082\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,52,35],"tags":[],"class_list":["post-9659","post","type-post","status-publish","format-standard","hentry","category-centos7","category-mysql","category-php"],"_links":{"self":[{"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/posts\/9659","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/comments?post=9659"}],"version-history":[{"count":16,"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/posts\/9659\/revisions"}],"predecessor-version":[{"id":9678,"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/posts\/9659\/revisions\/9678"}],"wp:attachment":[{"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/media?parent=9659"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/categories?post=9659"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.stuffy.site\/computers\/wp-json\/wp\/v2\/tags?post=9659"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}