{"id":178,"date":"2016-11-29T06:03:28","date_gmt":"2016-11-29T06:03:28","guid":{"rendered":"http:\/\/rat32.com\/rat32\/?p=178"},"modified":"2016-11-29T06:03:28","modified_gmt":"2016-11-29T06:03:28","slug":"how-to-solve-php-warning-mysqli_connect-hy0002002-connection-refused-problem","status":"publish","type":"post","link":"https:\/\/rat32.com\/rat32\/2016\/11\/29\/how-to-solve-php-warning-mysqli_connect-hy0002002-connection-refused-problem\/","title":{"rendered":"How to solve PHP Warning: mysqli_connect(): (HY000\/2002): Connection refused problem?"},"content":{"rendered":"<p>The default port on MAMP for mysql is 8889, but the port that php expects to use for mysql is 3306. So you need to change it. Open MAMP, go to <strong>Preferences<\/strong> and Ports<strong> and change the MAMP mysql port to 3306, then click ok. Then mysql server will be restarted by MAMP if not then restart it manually. Now the connection should be successful with host=localhost, user=root, pass=root.<\/p>\n<p>Hope it helps. If yes then don&#8217;t forget to comment below thanks.<\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>The default port on MAMP for mysql is 8889, but the port that php expects to use for mysql is 3306. So you need to change it. Open MAMP, go to Preferences and Ports&#46;&#46;&#46;<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,3],"tags":[100,99,95,93,94,98,84],"class_list":["post-178","post","type-post","status-publish","format-standard","hentry","category-how-to","category-php","tag-connection-refused","tag-hy0002002","tag-mac","tag-mamp","tag-mysql","tag-mysqli_connect","tag-php"],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/rat32.com\/rat32\/wp-json\/wp\/v2\/posts\/178"}],"collection":[{"href":"https:\/\/rat32.com\/rat32\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rat32.com\/rat32\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rat32.com\/rat32\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rat32.com\/rat32\/wp-json\/wp\/v2\/comments?post=178"}],"version-history":[{"count":1,"href":"https:\/\/rat32.com\/rat32\/wp-json\/wp\/v2\/posts\/178\/revisions"}],"predecessor-version":[{"id":179,"href":"https:\/\/rat32.com\/rat32\/wp-json\/wp\/v2\/posts\/178\/revisions\/179"}],"wp:attachment":[{"href":"https:\/\/rat32.com\/rat32\/wp-json\/wp\/v2\/media?parent=178"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rat32.com\/rat32\/wp-json\/wp\/v2\/categories?post=178"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rat32.com\/rat32\/wp-json\/wp\/v2\/tags?post=178"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}