{"id":1986,"date":"2020-07-05T22:00:41","date_gmt":"2020-07-05T22:00:41","guid":{"rendered":"http:\/\/www.theSQLReport.com\/?p=1986"},"modified":"2022-07-04T12:14:53","modified_gmt":"2022-07-04T12:14:53","slug":"bitnami-mariadb-virtual-machine-how-to-enable-port-3306-for-mariadb","status":"publish","type":"post","link":"https:\/\/www.theSQLReport.com\/?p=1986","title":{"rendered":"Bitnami MariaDB Virtual Machine &#8211; How To Enable Port 3306 for MariaDB"},"content":{"rendered":"<p>Bitnami virtual machines are great for quickly enabling an environment for testing or learning.\u00a0 Sometimes they can be a challenge when I want to use other software with them.<\/p>\n<p><strong>Problem:<\/strong><\/p>\n<p>I wanted to connect to the MariaDB database located on a Bitnami MariaDB Virtual Machine with the MySQL Workbench on my laptop&#8217;s software.<\/p>\n<p><a href=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2020\/07\/Bitnami_MariaDB_Connection_Error.jpg\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1990 size-full\" src=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2020\/07\/Bitnami_MariaDB_Connection_Error.jpg\" alt=\"\" width=\"364\" height=\"153\" \/><\/a><\/p>\n<p><strong>Already done to the Bitnami MariaDB Virtual Machine:<\/strong><\/p>\n<p>1. Using the DHCP address enabled by default on virtual machine (laziness &#8211; should set static IP address), my only configuration was enabling the network connection in my VM Workstation.<\/p>\n<p>2.\u00a0 Enabled the virtual machine for SSH connections for Debian, so I can make putty connections.<\/p>\n<p style=\"padding-left: 40px;\">Instructions:\u00a0 <a href=\"https:\/\/docs.bitnami.com\/virtual-machine\/faq\/get-started\/enable-ssh\/\" target=\"_blank\" rel=\"noopener noreferrer\">Enable or disable the SSH server &#8211; Debian<\/a><\/p>\n<p>3. Out of laziness, I am using the default bitnami OS user account and the root user for the MariaDB, credentials found:<\/p>\n<pre>cat \/home\/bitnami\/bitnami_credentials<\/pre>\n<p><strong>Resolution:<\/strong><\/p>\n<ol>\n<li>\u00a0Check netstat to see if the port is enabled for only the local server.\u00a0 If you see that port 3306 is enabled only for 127.0.0.1, then only connections on that server can be made using that port.<\/li>\n<\/ol>\n<pre>sudo netstat -ntlup | grep mysql<\/pre>\n<p><a href=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2020\/07\/Problem_Port_3306.jpg\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1988 size-full\" src=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2020\/07\/Problem_Port_3306.jpg\" alt=\"\" width=\"664\" height=\"413\" srcset=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2020\/07\/Problem_Port_3306.jpg 664w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2020\/07\/Problem_Port_3306-300x187.jpg 300w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2020\/07\/Problem_Port_3306-210x131.jpg 210w\" sizes=\"(max-width: 664px) 100vw, 664px\" \/><\/a><\/p>\n<p style=\"padding-left: 40px;\">2. To correct the problem above, the my.cnf file will need to be edited:<\/p>\n<pre>sudo vi \/opt\/bitnami\/mariadb\/conf\/my.cnf<\/pre>\n<p><a href=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2020\/07\/my.cnf_bind_address_before.jpg\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1994 size-full\" src=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2020\/07\/my.cnf_bind_address_before.jpg\" alt=\"\" width=\"663\" height=\"413\" srcset=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2020\/07\/my.cnf_bind_address_before.jpg 663w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2020\/07\/my.cnf_bind_address_before-300x187.jpg 300w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2020\/07\/my.cnf_bind_address_before-210x131.jpg 210w\" sizes=\"(max-width: 663px) 100vw, 663px\" \/><\/a><\/p>\n<p>The only parameter that need to be changed is the bind_address.\u00a0 Change the &#8220;127.0.0.1&#8221; to &#8221; :: &#8220;, and this will allow any IP address to access the database (don&#8217;t do this on your production MariaDB servers, or it will fail any auditor security scans).<\/p>\n<p><a href=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2020\/07\/my.cnf_bind_address_corrected.jpg\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1995 size-full\" src=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2020\/07\/my.cnf_bind_address_corrected.jpg\" alt=\"\" width=\"667\" height=\"413\" srcset=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2020\/07\/my.cnf_bind_address_corrected.jpg 667w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2020\/07\/my.cnf_bind_address_corrected-300x186.jpg 300w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2020\/07\/my.cnf_bind_address_corrected-210x130.jpg 210w\" sizes=\"(max-width: 667px) 100vw, 667px\" \/><\/a><\/p>\n<p>Then save &amp; close the my.cnf configuration file.<\/p>\n<p style=\"padding-left: 40px;\">3.\u00a0 Set the firewall to allow connections on port 3306.<\/p>\n<pre>sudo ufw allow 3306<\/pre>\n<p><a href=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2020\/07\/Firewall_Allow_3306.jpg\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1993 size-full\" src=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2020\/07\/Firewall_Allow_3306.jpg\" alt=\"\" width=\"347\" height=\"143\" srcset=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2020\/07\/Firewall_Allow_3306.jpg 347w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2020\/07\/Firewall_Allow_3306-300x124.jpg 300w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2020\/07\/Firewall_Allow_3306-210x87.jpg 210w\" sizes=\"(max-width: 347px) 100vw, 347px\" \/><\/a><\/p>\n<p style=\"padding-left: 40px;\">4.\u00a0 Again out of laziness, I just rebooted to reset the configurations of the database &amp; firewall.<\/p>\n<pre>sudo reboot<\/pre>\n<p><a href=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2020\/07\/Reboot_Linux.jpg\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1989 size-full\" src=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2020\/07\/Reboot_Linux.jpg\" alt=\"\" width=\"480\" height=\"279\" srcset=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2020\/07\/Reboot_Linux.jpg 480w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2020\/07\/Reboot_Linux-300x174.jpg 300w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2020\/07\/Reboot_Linux-210x122.jpg 210w\" sizes=\"(max-width: 480px) 100vw, 480px\" \/><\/a><\/p>\n<p>5.\u00a0 Great thing about this virtual machine is that it rebooted in less than minute on my old laptop.\u00a0 Then I was able to verify port 3306 was available.<\/p>\n<pre>sudo netstat -ntlup | grep mysql<\/pre>\n<p><a href=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2020\/07\/Corrected_Port_3306.jpg\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1992 size-full\" src=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2020\/07\/Corrected_Port_3306.jpg\" alt=\"\" width=\"619\" height=\"168\" srcset=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2020\/07\/Corrected_Port_3306.jpg 619w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2020\/07\/Corrected_Port_3306-300x81.jpg 300w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2020\/07\/Corrected_Port_3306-210x57.jpg 210w\" sizes=\"(max-width: 619px) 100vw, 619px\" \/><\/a>Then I tested the connection in the MySQL Workbench successfully.<\/p>\n<p><a href=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2020\/07\/Bitnami_MariaDB_Connection_Success.jpg\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1991 size-full\" src=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2020\/07\/Bitnami_MariaDB_Connection_Success.jpg\" alt=\"\" width=\"364\" height=\"153\" srcset=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2020\/07\/Bitnami_MariaDB_Connection_Success.jpg 364w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2020\/07\/Bitnami_MariaDB_Connection_Success-300x126.jpg 300w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2020\/07\/Bitnami_MariaDB_Connection_Success-210x88.jpg 210w\" sizes=\"(max-width: 364px) 100vw, 364px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Bitnami virtual machines are great for quickly enabling an environment for testing or learning.\u00a0 Sometimes they can be a challenge when I want to use other software with them. Problem: &hellip; <a class=\"readmore\" href=\"https:\/\/www.theSQLReport.com\/?p=1986\">Continue Reading &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":1990,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[188,190,189,187],"class_list":["post-1986","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","tag-bitnami","tag-my-cnf","tag-mysql-workbench","tag-port-3306"],"_links":{"self":[{"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/posts\/1986"}],"collection":[{"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1986"}],"version-history":[{"count":8,"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/posts\/1986\/revisions"}],"predecessor-version":[{"id":2003,"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/posts\/1986\/revisions\/2003"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/media\/1990"}],"wp:attachment":[{"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1986"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1986"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.theSQLReport.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1986"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}