{"id":2835,"date":"2021-10-22T00:17:28","date_gmt":"2021-10-22T08:17:28","guid":{"rendered":"https:\/\/wonghoi.humgar.com\/blog\/?p=2835"},"modified":"2021-10-22T00:17:30","modified_gmt":"2021-10-22T08:17:30","slug":"dbeaver-connecting-to-mysql-in-namecheap-shared-hosting","status":"publish","type":"post","link":"https:\/\/wonghoi.humgar.com\/blog\/2021\/10\/22\/dbeaver-connecting-to-mysql-in-namecheap-shared-hosting\/","title":{"rendered":"DBeaver connecting to MySQL in Namecheap Shared Hosting"},"content":{"rendered":"\n<p>Namecheap already provided instructions to connect <a href=\"https:\/\/www.namecheap.com\/support\/knowledgebase\/article.aspx\/9330\/2180\/how-to-connect-to-a-database-using-the-workbench-mysql-client\/\">MySQL Workbench client<\/a> for its shared hosting, which involves <a href=\"https:\/\/www.namecheap.com\/support\/knowledgebase\/article.aspx\/1249\/89\/how-to-remotely-connect-to-a-mysql-database-located-on-our-shared-server\/\">SSH-tunneling<\/a> because they disallowed direct MySQL connection out of security concerns.<\/p>\n\n\n\n<p>So here&#8217;s basically the logistics:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>SSH to your namecheap hostname (can use your domain name) at SSH port <code>21098<\/code><\/li><li>Tunnel listens to Port <code>5522 <\/code>and forward it to <code>localhost<\/code> (the client itself) at MySQL Port <code>3306<\/code><\/li><li>Instead of connecting directly to the<code> {namecheap shared hosting server}:3306<\/code>, connect to the <code>localhost:3306<\/code><\/li><\/ol>\n\n\n\n<p>It&#8217;s a little confusing on how to do it on DBeaver because &#8220;Advanced settings&#8221; is hidden by default which you will need. The name &#8216;local client&#8217; (source) vs &#8216;remote&#8217; (destination) in the dialog box is confusing. It&#8217;s actually <a href=\"https:\/\/explainshell.com\/explain?cmd=ssh+-L+-N+-f+-l\">equivalent<\/a> to <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ssh -L &#91;\"<em>Local host<\/em>\":]\"<em>Local port<\/em>\":\"<em>Remote host<\/em>\":\"<em>Remote port<\/em>\"\nssh -L &#91;bind_address:]port:host:hostport<\/code><\/pre>\n\n\n\n<p><code>bind_address<\/code> can be left blank. If you are paranoid and don&#8217;t want other machines to use your current MySQL client machine as a gateway (they tunnel into your machine to use the tunnel you are currently establishing), set (aka bind) it to <code>localhost<\/code>, or you can bind it to the client&#8217;s network adapter&#8217;s IP which you want to allow machines on a trusted network to use this MySQL client computer as a gateway.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"779\" height=\"546\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/uploads\/2021\/10\/Dbeaver-for-Namecheap.png\" alt=\"\" class=\"wp-image-2836\" srcset=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/uploads\/2021\/10\/Dbeaver-for-Namecheap.png 779w, https:\/\/wonghoi.humgar.com\/blog\/wp-content\/uploads\/2021\/10\/Dbeaver-for-Namecheap-300x210.png 300w, https:\/\/wonghoi.humgar.com\/blog\/wp-content\/uploads\/2021\/10\/Dbeaver-for-Namecheap-768x538.png 768w\" sizes=\"auto, (max-width: 779px) 100vw, 779px\" \/><\/figure>\n\n\n\n<p>For some reason (I suspect it&#8217;s IPv6), &#8220;Remote host&#8221; needs to be set to the loopback adapter 127.0.0.1 (cannot use the special hostname &#8216;<code>localhost<\/code>&#8216;). <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"779\" height=\"546\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/uploads\/2021\/10\/Dbeaver-for-Namecheap-Main.png\" alt=\"\" class=\"wp-image-2837\" srcset=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/uploads\/2021\/10\/Dbeaver-for-Namecheap-Main.png 779w, https:\/\/wonghoi.humgar.com\/blog\/wp-content\/uploads\/2021\/10\/Dbeaver-for-Namecheap-Main-300x210.png 300w, https:\/\/wonghoi.humgar.com\/blog\/wp-content\/uploads\/2021\/10\/Dbeaver-for-Namecheap-Main-768x538.png 768w\" sizes=\"auto, (max-width: 779px) 100vw, 779px\" \/><\/figure>\n\n\n\n<p>Remember MySQL&#8217;s username and password is the special database-only login credentials you created at cPanel.<\/p>\n<div class=\"pvc_clear\"><\/div><p id=\"pvc_stats_2835\" class=\"pvc_stats all  \" data-element-id=\"2835\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p><div class=\"pvc_clear\"><\/div>","protected":false},"excerpt":{"rendered":"<p>Namecheap already provided instructions to connect MySQL Workbench client for its shared hosting, which involves SSH-tunneling because they disallowed direct MySQL connection out of security concerns. So here&#8217;s basically the logistics: SSH to your namecheap hostname (can use your domain &hellip; <a href=\"https:\/\/wonghoi.humgar.com\/blog\/2021\/10\/22\/dbeaver-connecting-to-mysql-in-namecheap-shared-hosting\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n<div class=\"pvc_clear\"><\/div>\n<p id=\"pvc_stats_2835\" class=\"pvc_stats all  \" data-element-id=\"2835\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> <img loading=\"lazy\" decoding=\"async\" width=\"16\" height=\"16\" alt=\"Loading\" src=\"https:\/\/wonghoi.humgar.com\/blog\/wp-content\/plugins\/page-views-count\/ajax-loader-2x.gif\" border=0 \/><\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[42],"tags":[],"class_list":["post-2835","post","type-post","status-publish","format-standard","hentry","category-web-services"],"_links":{"self":[{"href":"https:\/\/wonghoi.humgar.com\/blog\/wp-json\/wp\/v2\/posts\/2835","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wonghoi.humgar.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wonghoi.humgar.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wonghoi.humgar.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wonghoi.humgar.com\/blog\/wp-json\/wp\/v2\/comments?post=2835"}],"version-history":[{"count":1,"href":"https:\/\/wonghoi.humgar.com\/blog\/wp-json\/wp\/v2\/posts\/2835\/revisions"}],"predecessor-version":[{"id":2838,"href":"https:\/\/wonghoi.humgar.com\/blog\/wp-json\/wp\/v2\/posts\/2835\/revisions\/2838"}],"wp:attachment":[{"href":"https:\/\/wonghoi.humgar.com\/blog\/wp-json\/wp\/v2\/media?parent=2835"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wonghoi.humgar.com\/blog\/wp-json\/wp\/v2\/categories?post=2835"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wonghoi.humgar.com\/blog\/wp-json\/wp\/v2\/tags?post=2835"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}