allow remote mysql access (through webmin or shell) The Next CEO of Stack OverflowGufw rule to...

MT "will strike" & LXX "will watch carefully" (Gen 3:15)?

How to unfasten electrical subpanel attached with ramset

How do I secure a TV wall mount?

How to pronounce fünf in 45

Find the majority element, which appears more than half the time

Why doesn't Shulchan Aruch include the laws of destroying fruit trees?

Can you teleport closer to a creature you are Frightened of?

Car headlights in a world without electricity

What is the difference between 'contrib' and 'non-free' packages repositories?

Direct Implications Between USA and UK in Event of No-Deal Brexit

Are British MPs missing the point, with these 'Indicative Votes'?

Ising model simulation

Why do we say “un seul M” and not “une seule M” even though M is a “consonne”?

Small nick on power cord from an electric alarm clock, and copper wiring exposed but intact

Is it a bad idea to plug the other end of ESD strap to wall ground?

Creating a script with console commands

Simplify trigonometric expression using trigonometric identities

What difference does it make matching a word with/without a trailing whitespace?

Would a grinding machine be a simple and workable propulsion system for an interplanetary spacecraft?

Airship steam engine room - problems and conflict

Find a path from s to t using as few red nodes as possible

Could a dragon use its wings to swim?

Create custom note boxes

Free fall ellipse or parabola?



allow remote mysql access (through webmin or shell)



The Next CEO of Stack OverflowGufw rule to allow mysql on home networkdefault shell for remote commands through sshWhy does my MySQL remote-connection fail (VLAN)?What alternatives to MS Access exist for database management on the Ubuntu platform (LibreOffice Base isn't cutting it)Setting up remote access through LandscapeUnable to access webmin?Can't access webmin from remote/local computerAllow remote ssh accessWebmin MySql error messageMySQL Workbench allow remote connectionsRemote access Ubuntu Server filesystem through GUI












3















Spec:
Ubuntu 14.04
webmin/virtualmin 1.791



I am using following code to test remote mysql database connection:



<?php

$db_host = "123.456.789";
$db_name = "database";
$db_user = "user";
$db_pass = "password";
$db_table_prefix = "prefix_";



GLOBAL $errors;
GLOBAL $successes;

$errors = array();
$successes = array();

$mysqli = new mysqli($db_host, $db_user, $db_pass, $db_name);
GLOBAL $mysqli;

if(mysqli_connect_errno()) {
echo "Conn Error = " . mysqli_connect_error();
exit();
}

?>


I keep getting this error:




No connection could be made because the target machine actively
refused it.




Research shows this means the server is "not listening". Before I ran the above script I've already tried to allow remote mysql access through webmin gui. What I did is editting "database manage->host permissions" and make it as follows:



enter image description here



This was supposed to allow remote mysql access but it doesn't work. Also I read from somewhere else that to allow remote mysql access I need to edit /etc/mysql/my.cnf; I have thought that after I edit the "host permissions" in webmin this file would be changed, but it was not. On the other hand, I couldn't find the lines I was supposed to edit in my.cnf, so I am stuck here.



Any help is appreciated.










share|improve this question



























    3















    Spec:
    Ubuntu 14.04
    webmin/virtualmin 1.791



    I am using following code to test remote mysql database connection:



    <?php

    $db_host = "123.456.789";
    $db_name = "database";
    $db_user = "user";
    $db_pass = "password";
    $db_table_prefix = "prefix_";



    GLOBAL $errors;
    GLOBAL $successes;

    $errors = array();
    $successes = array();

    $mysqli = new mysqli($db_host, $db_user, $db_pass, $db_name);
    GLOBAL $mysqli;

    if(mysqli_connect_errno()) {
    echo "Conn Error = " . mysqli_connect_error();
    exit();
    }

    ?>


    I keep getting this error:




    No connection could be made because the target machine actively
    refused it.




    Research shows this means the server is "not listening". Before I ran the above script I've already tried to allow remote mysql access through webmin gui. What I did is editting "database manage->host permissions" and make it as follows:



    enter image description here



    This was supposed to allow remote mysql access but it doesn't work. Also I read from somewhere else that to allow remote mysql access I need to edit /etc/mysql/my.cnf; I have thought that after I edit the "host permissions" in webmin this file would be changed, but it was not. On the other hand, I couldn't find the lines I was supposed to edit in my.cnf, so I am stuck here.



    Any help is appreciated.










    share|improve this question

























      3












      3








      3


      3






      Spec:
      Ubuntu 14.04
      webmin/virtualmin 1.791



      I am using following code to test remote mysql database connection:



      <?php

      $db_host = "123.456.789";
      $db_name = "database";
      $db_user = "user";
      $db_pass = "password";
      $db_table_prefix = "prefix_";



      GLOBAL $errors;
      GLOBAL $successes;

      $errors = array();
      $successes = array();

      $mysqli = new mysqli($db_host, $db_user, $db_pass, $db_name);
      GLOBAL $mysqli;

      if(mysqli_connect_errno()) {
      echo "Conn Error = " . mysqli_connect_error();
      exit();
      }

      ?>


      I keep getting this error:




      No connection could be made because the target machine actively
      refused it.




      Research shows this means the server is "not listening". Before I ran the above script I've already tried to allow remote mysql access through webmin gui. What I did is editting "database manage->host permissions" and make it as follows:



      enter image description here



      This was supposed to allow remote mysql access but it doesn't work. Also I read from somewhere else that to allow remote mysql access I need to edit /etc/mysql/my.cnf; I have thought that after I edit the "host permissions" in webmin this file would be changed, but it was not. On the other hand, I couldn't find the lines I was supposed to edit in my.cnf, so I am stuck here.



      Any help is appreciated.










      share|improve this question














      Spec:
      Ubuntu 14.04
      webmin/virtualmin 1.791



      I am using following code to test remote mysql database connection:



      <?php

      $db_host = "123.456.789";
      $db_name = "database";
      $db_user = "user";
      $db_pass = "password";
      $db_table_prefix = "prefix_";



      GLOBAL $errors;
      GLOBAL $successes;

      $errors = array();
      $successes = array();

      $mysqli = new mysqli($db_host, $db_user, $db_pass, $db_name);
      GLOBAL $mysqli;

      if(mysqli_connect_errno()) {
      echo "Conn Error = " . mysqli_connect_error();
      exit();
      }

      ?>


      I keep getting this error:




      No connection could be made because the target machine actively
      refused it.




      Research shows this means the server is "not listening". Before I ran the above script I've already tried to allow remote mysql access through webmin gui. What I did is editting "database manage->host permissions" and make it as follows:



      enter image description here



      This was supposed to allow remote mysql access but it doesn't work. Also I read from somewhere else that to allow remote mysql access I need to edit /etc/mysql/my.cnf; I have thought that after I edit the "host permissions" in webmin this file would be changed, but it was not. On the other hand, I couldn't find the lines I was supposed to edit in my.cnf, so I am stuck here.



      Any help is appreciated.







      remote-access database webmin






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 30 '16 at 0:30









      shenkwenshenkwen

      1841212




      1841212






















          2 Answers
          2






          active

          oldest

          votes


















          6














          Login mysql mysql -u yourname -p yourpassword,then follow like this



          mysql>use mysql;
          mysql>select host,user from user;


          It may give the following result:



          +-----------+------------------+
          | host | user |
          +-----------+------------------+
          | 127.0.0.1 | root |
          | ::1 | root |
          | localhost | debian-sys-maint |
          | localhost | root |
          +-----------+------------------+
          4 rows in set (0.00 sec)


          If you see that, it means you can only connect mysql in localhost,so you need do the following steps:



          mysql>GRANT ALL PRIVILEGES ON *.* TO username@"%" IDENTIFIED BY "password";
          Query OK, 0 rows affected (0.00 sec)
          mysql>flush privileges;
          Query OK, 0 rows affected (0.00 sec)


          "%"means any host can remotely log on to the server,if you want to restrict access to only a machine,you need to change the "%" to the IP address of the machine you want to allow to connect.



          If it works,then you select host,user from user;,you will get the following info:



          +-----------+------------------+
          | host | user |
          +-----------+------------------+
          | % | root |
          | 127.0.0.1 | root |
          | ::1 | root |
          | localhost | debian-sys-maint |
          | localhost | root |
          +-----------+------------------+
          5 rows in set (0.00 sec)


          Exit mysql,edit /etc/mysql/my.cnf,find



          # Instead of skip-networking the default is now to listen only on
          # localhost which is more compatible and is not less secure.
          bind-address = 127.0.0.1


          annotate it or you can delete it(not recommended),restart your mysql server,usingservice mysql restart,if you do this like me,you may solve the problem.



          It works well in my computer(ubuntu 14.04+mysql 5.5)






          share|improve this answer



















          • 1





            In my case, /etc/mysql/my.cnf was empty, with the exception of two lines (!include) references. I went to the second reference (mysqld.cnf) where I found the bind-address section. Works like a charm.

            – Pepito Fernandez
            Jul 9 '16 at 15:10



















          0














          I wish the guys would reread and try what out what they write and the trailing stars are really annoying. Half the stuff on these boards are right in thought but most are sloppy solutions where the noobs just get more frustrated.



          Please edit your work- it helps everyone out.






          share|improve this answer








          New contributor




          dinky doo doo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.





















            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "89"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f751679%2fallow-remote-mysql-access-through-webmin-or-shell%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            6














            Login mysql mysql -u yourname -p yourpassword,then follow like this



            mysql>use mysql;
            mysql>select host,user from user;


            It may give the following result:



            +-----------+------------------+
            | host | user |
            +-----------+------------------+
            | 127.0.0.1 | root |
            | ::1 | root |
            | localhost | debian-sys-maint |
            | localhost | root |
            +-----------+------------------+
            4 rows in set (0.00 sec)


            If you see that, it means you can only connect mysql in localhost,so you need do the following steps:



            mysql>GRANT ALL PRIVILEGES ON *.* TO username@"%" IDENTIFIED BY "password";
            Query OK, 0 rows affected (0.00 sec)
            mysql>flush privileges;
            Query OK, 0 rows affected (0.00 sec)


            "%"means any host can remotely log on to the server,if you want to restrict access to only a machine,you need to change the "%" to the IP address of the machine you want to allow to connect.



            If it works,then you select host,user from user;,you will get the following info:



            +-----------+------------------+
            | host | user |
            +-----------+------------------+
            | % | root |
            | 127.0.0.1 | root |
            | ::1 | root |
            | localhost | debian-sys-maint |
            | localhost | root |
            +-----------+------------------+
            5 rows in set (0.00 sec)


            Exit mysql,edit /etc/mysql/my.cnf,find



            # Instead of skip-networking the default is now to listen only on
            # localhost which is more compatible and is not less secure.
            bind-address = 127.0.0.1


            annotate it or you can delete it(not recommended),restart your mysql server,usingservice mysql restart,if you do this like me,you may solve the problem.



            It works well in my computer(ubuntu 14.04+mysql 5.5)






            share|improve this answer



















            • 1





              In my case, /etc/mysql/my.cnf was empty, with the exception of two lines (!include) references. I went to the second reference (mysqld.cnf) where I found the bind-address section. Works like a charm.

              – Pepito Fernandez
              Jul 9 '16 at 15:10
















            6














            Login mysql mysql -u yourname -p yourpassword,then follow like this



            mysql>use mysql;
            mysql>select host,user from user;


            It may give the following result:



            +-----------+------------------+
            | host | user |
            +-----------+------------------+
            | 127.0.0.1 | root |
            | ::1 | root |
            | localhost | debian-sys-maint |
            | localhost | root |
            +-----------+------------------+
            4 rows in set (0.00 sec)


            If you see that, it means you can only connect mysql in localhost,so you need do the following steps:



            mysql>GRANT ALL PRIVILEGES ON *.* TO username@"%" IDENTIFIED BY "password";
            Query OK, 0 rows affected (0.00 sec)
            mysql>flush privileges;
            Query OK, 0 rows affected (0.00 sec)


            "%"means any host can remotely log on to the server,if you want to restrict access to only a machine,you need to change the "%" to the IP address of the machine you want to allow to connect.



            If it works,then you select host,user from user;,you will get the following info:



            +-----------+------------------+
            | host | user |
            +-----------+------------------+
            | % | root |
            | 127.0.0.1 | root |
            | ::1 | root |
            | localhost | debian-sys-maint |
            | localhost | root |
            +-----------+------------------+
            5 rows in set (0.00 sec)


            Exit mysql,edit /etc/mysql/my.cnf,find



            # Instead of skip-networking the default is now to listen only on
            # localhost which is more compatible and is not less secure.
            bind-address = 127.0.0.1


            annotate it or you can delete it(not recommended),restart your mysql server,usingservice mysql restart,if you do this like me,you may solve the problem.



            It works well in my computer(ubuntu 14.04+mysql 5.5)






            share|improve this answer



















            • 1





              In my case, /etc/mysql/my.cnf was empty, with the exception of two lines (!include) references. I went to the second reference (mysqld.cnf) where I found the bind-address section. Works like a charm.

              – Pepito Fernandez
              Jul 9 '16 at 15:10














            6












            6








            6







            Login mysql mysql -u yourname -p yourpassword,then follow like this



            mysql>use mysql;
            mysql>select host,user from user;


            It may give the following result:



            +-----------+------------------+
            | host | user |
            +-----------+------------------+
            | 127.0.0.1 | root |
            | ::1 | root |
            | localhost | debian-sys-maint |
            | localhost | root |
            +-----------+------------------+
            4 rows in set (0.00 sec)


            If you see that, it means you can only connect mysql in localhost,so you need do the following steps:



            mysql>GRANT ALL PRIVILEGES ON *.* TO username@"%" IDENTIFIED BY "password";
            Query OK, 0 rows affected (0.00 sec)
            mysql>flush privileges;
            Query OK, 0 rows affected (0.00 sec)


            "%"means any host can remotely log on to the server,if you want to restrict access to only a machine,you need to change the "%" to the IP address of the machine you want to allow to connect.



            If it works,then you select host,user from user;,you will get the following info:



            +-----------+------------------+
            | host | user |
            +-----------+------------------+
            | % | root |
            | 127.0.0.1 | root |
            | ::1 | root |
            | localhost | debian-sys-maint |
            | localhost | root |
            +-----------+------------------+
            5 rows in set (0.00 sec)


            Exit mysql,edit /etc/mysql/my.cnf,find



            # Instead of skip-networking the default is now to listen only on
            # localhost which is more compatible and is not less secure.
            bind-address = 127.0.0.1


            annotate it or you can delete it(not recommended),restart your mysql server,usingservice mysql restart,if you do this like me,you may solve the problem.



            It works well in my computer(ubuntu 14.04+mysql 5.5)






            share|improve this answer













            Login mysql mysql -u yourname -p yourpassword,then follow like this



            mysql>use mysql;
            mysql>select host,user from user;


            It may give the following result:



            +-----------+------------------+
            | host | user |
            +-----------+------------------+
            | 127.0.0.1 | root |
            | ::1 | root |
            | localhost | debian-sys-maint |
            | localhost | root |
            +-----------+------------------+
            4 rows in set (0.00 sec)


            If you see that, it means you can only connect mysql in localhost,so you need do the following steps:



            mysql>GRANT ALL PRIVILEGES ON *.* TO username@"%" IDENTIFIED BY "password";
            Query OK, 0 rows affected (0.00 sec)
            mysql>flush privileges;
            Query OK, 0 rows affected (0.00 sec)


            "%"means any host can remotely log on to the server,if you want to restrict access to only a machine,you need to change the "%" to the IP address of the machine you want to allow to connect.



            If it works,then you select host,user from user;,you will get the following info:



            +-----------+------------------+
            | host | user |
            +-----------+------------------+
            | % | root |
            | 127.0.0.1 | root |
            | ::1 | root |
            | localhost | debian-sys-maint |
            | localhost | root |
            +-----------+------------------+
            5 rows in set (0.00 sec)


            Exit mysql,edit /etc/mysql/my.cnf,find



            # Instead of skip-networking the default is now to listen only on
            # localhost which is more compatible and is not less secure.
            bind-address = 127.0.0.1


            annotate it or you can delete it(not recommended),restart your mysql server,usingservice mysql restart,if you do this like me,you may solve the problem.



            It works well in my computer(ubuntu 14.04+mysql 5.5)







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Mar 30 '16 at 6:50









            zero luzero lu

            763




            763








            • 1





              In my case, /etc/mysql/my.cnf was empty, with the exception of two lines (!include) references. I went to the second reference (mysqld.cnf) where I found the bind-address section. Works like a charm.

              – Pepito Fernandez
              Jul 9 '16 at 15:10














            • 1





              In my case, /etc/mysql/my.cnf was empty, with the exception of two lines (!include) references. I went to the second reference (mysqld.cnf) where I found the bind-address section. Works like a charm.

              – Pepito Fernandez
              Jul 9 '16 at 15:10








            1




            1





            In my case, /etc/mysql/my.cnf was empty, with the exception of two lines (!include) references. I went to the second reference (mysqld.cnf) where I found the bind-address section. Works like a charm.

            – Pepito Fernandez
            Jul 9 '16 at 15:10





            In my case, /etc/mysql/my.cnf was empty, with the exception of two lines (!include) references. I went to the second reference (mysqld.cnf) where I found the bind-address section. Works like a charm.

            – Pepito Fernandez
            Jul 9 '16 at 15:10













            0














            I wish the guys would reread and try what out what they write and the trailing stars are really annoying. Half the stuff on these boards are right in thought but most are sloppy solutions where the noobs just get more frustrated.



            Please edit your work- it helps everyone out.






            share|improve this answer








            New contributor




            dinky doo doo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.

























              0














              I wish the guys would reread and try what out what they write and the trailing stars are really annoying. Half the stuff on these boards are right in thought but most are sloppy solutions where the noobs just get more frustrated.



              Please edit your work- it helps everyone out.






              share|improve this answer








              New contributor




              dinky doo doo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
              Check out our Code of Conduct.























                0












                0








                0







                I wish the guys would reread and try what out what they write and the trailing stars are really annoying. Half the stuff on these boards are right in thought but most are sloppy solutions where the noobs just get more frustrated.



                Please edit your work- it helps everyone out.






                share|improve this answer








                New contributor




                dinky doo doo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.










                I wish the guys would reread and try what out what they write and the trailing stars are really annoying. Half the stuff on these boards are right in thought but most are sloppy solutions where the noobs just get more frustrated.



                Please edit your work- it helps everyone out.







                share|improve this answer








                New contributor




                dinky doo doo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.









                share|improve this answer



                share|improve this answer






                New contributor




                dinky doo doo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.









                answered 20 mins ago









                dinky doo doodinky doo doo

                1




                1




                New contributor




                dinky doo doo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.





                New contributor





                dinky doo doo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.






                dinky doo doo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                Check out our Code of Conduct.






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Ask Ubuntu!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f751679%2fallow-remote-mysql-access-through-webmin-or-shell%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Why do type traits not work with types in namespace scope?What are POD types in C++?Why can templates only be...

                    Will tsunami waves travel forever if there was no land?Why do tsunami waves begin with the water flowing away...

                    Simple Scan not detecting my scanner (Brother DCP-7055W)Brother MFC-L2700DW printer can print, can't...