{"id":148,"date":"2004-05-26T19:05:06","date_gmt":"2004-05-26T17:05:06","guid":{"rendered":"http:\/\/gnu.inter.it\/blogs\/fabu\/?p=148"},"modified":"2004-05-26T19:05:06","modified_gmt":"2004-05-26T17:05:06","slug":"localhost-127001","status":"publish","type":"post","link":"https:\/\/fabioinvernizzi.com\/blog\/2004\/05\/26\/localhost-127001\/","title":{"rendered":"localhost != 127.0.0.1"},"content":{"rendered":"<p>Almeno per mysql (il client) localhost e 127.0.0.1 sono due cose diverse :-\/<\/p>\n<p>Infatti mentre &#8220;<code>mysql -h localhost<\/code>&#8221; usa un socket unix, &#8220;<code>mysql -h 127.0.0.1<\/code>&#8221; usa un socket IPv4.<\/p>\n<p>Ci ho sbattuto la testa facendo dei test con il Corra su un banale tunnel ssh:<br \/>\n<code>ssh -N -f -L 4406:localhost:3306 mioserver<\/code> <\/p>\n<p>Tentando di collegarmi: &#8220;<code>mysql -h localhost -P 4406 ...<\/code>&#8221;<br \/>\nmi trovavo collegato al daemon sulla mia macchina&#8230; usando il socket unix il client non segnala il fatto che il &#8220;-P&#8221; viene bellamente ignorato :-\/<\/p>\n<p>L&#8217;unico modo \u00e8 quindi:  &#8220;<code>mysql -h 127.0.0.1 -P 4406 ...<\/code>&#8221;<\/p>\n<p>Unica accortezza, se si vuole accedere al server solo tramite tunnel \u00e8 quindi quella di mettere un bel &#8220;<code>bind-address=127.0.0.1<\/code>&#8221; in my.cnf.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Almeno per mysql (il client) localhost e 127.0.0.1 sono due cose diverse :-\/ Infatti mentre &#8220;mysql -h localhost&#8221; usa un socket unix, &#8220;mysql -h 127.0.0.1&#8221; usa un socket IPv4. Ci ho sbattuto la testa facendo dei test con il Corra su un banale tunnel ssh: ssh -N -f -L 4406:localhost:3306 mioserver Tentando di collegarmi: &#8220;mysql &hellip; <a href=\"https:\/\/fabioinvernizzi.com\/blog\/2004\/05\/26\/localhost-127001\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">localhost != 127.0.0.1<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[2],"tags":[3],"class_list":["post-148","post","type-post","status-publish","format-standard","hentry","category-me","tag-hacking"],"_links":{"self":[{"href":"https:\/\/fabioinvernizzi.com\/blog\/wp-json\/wp\/v2\/posts\/148"}],"collection":[{"href":"https:\/\/fabioinvernizzi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fabioinvernizzi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fabioinvernizzi.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/fabioinvernizzi.com\/blog\/wp-json\/wp\/v2\/comments?post=148"}],"version-history":[{"count":0,"href":"https:\/\/fabioinvernizzi.com\/blog\/wp-json\/wp\/v2\/posts\/148\/revisions"}],"wp:attachment":[{"href":"https:\/\/fabioinvernizzi.com\/blog\/wp-json\/wp\/v2\/media?parent=148"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fabioinvernizzi.com\/blog\/wp-json\/wp\/v2\/categories?post=148"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fabioinvernizzi.com\/blog\/wp-json\/wp\/v2\/tags?post=148"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}