Allow all remote connections, MySQLEnable remote MySQL connection: ERROR 1045 (28000): Access denied for userHow to easily and safely connect to postgres or mysql remotely?SQL connection : can't connect to database in javaHow to access to phpmyadmin on Digital OceanMySQL and C# connection errorCannot remotely connect to databaseCan not connect to database sonarqube with mysql in dockerHow do I connect to a remote MYSQL server on Windows from a Linux Machine?Create new Mysql user which can be accessed from any end pointHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?Host 'xxx.xx.xxx.xxx' is not allowed to connect to this MySQL serverhow to mysqldump remote db from local machinebrew install mysql on macOSHow to grant remote access permissions to mysql server for user?Enable remote MySQL connection: ERROR 1045 (28000): Access denied for userAccess mysql remote database from command lineCannot connect remotely to EC2 MySQL installationHow to open remote MySQL connection at a LAMP(Python) stack

What weight should be given to writers groups critiques?

Why did Jon Snow do this immoral act if he is so honorable?

How to politely tell someone they did not hit "reply to all" in an email?

What does kpsewhich stand for?

Why are GND pads often only connected by four traces?

On San Andreas Speedruns, why do players blow up the Picador in the mission Ryder?

Beginner looking to learn/master musical theory and instrumental ability. Where should I begin?

Security vulnerabilities of POST over SSL

Is my plasma cannon concept viable?

Mysterious procedure calls without parameters - but no exceptions generated

Why did Drogon spare this character?

Why does this if statement return true

Of strange atmospheres - the survivable but unbreathable

Need to read my home electrical Meter

Parallel fifths in the orchestra

Why are Stein manifolds/spaces the analog of affine varieties/schemes in algebraic geometry?

How to cut a climbing rope?

Where is Jon going?

Can I tell a prospective employee that everyone in the team is leaving?

Is it possible to remotely hack the GPS system and disable GPS service worldwide?

Dad jokes are fun

Make 24 using exactly three 3s

What was the idiom for something that we take without a doubt?

Why did other houses not demand this?



Allow all remote connections, MySQL


Enable remote MySQL connection: ERROR 1045 (28000): Access denied for userHow to easily and safely connect to postgres or mysql remotely?SQL connection : can't connect to database in javaHow to access to phpmyadmin on Digital OceanMySQL and C# connection errorCannot remotely connect to databaseCan not connect to database sonarqube with mysql in dockerHow do I connect to a remote MYSQL server on Windows from a Linux Machine?Create new Mysql user which can be accessed from any end pointHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?Host 'xxx.xx.xxx.xxx' is not allowed to connect to this MySQL serverhow to mysqldump remote db from local machinebrew install mysql on macOSHow to grant remote access permissions to mysql server for user?Enable remote MySQL connection: ERROR 1045 (28000): Access denied for userAccess mysql remote database from command lineCannot connect remotely to EC2 MySQL installationHow to open remote MySQL connection at a LAMP(Python) stack






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








54















I had been using SQL Server and am now using MySQL for a project. With SQL Server, our developers can connect to the remote database on their local machines if they know the host, username, password. With MySQL, though, to give a developer access from their local machines, I have been having to log in to MySQL and execute:



GRANT ALL ON *.* to user@address IDENTIFIED BY 'password'; 
flush privileges;


Where address is the IP address of the developer's machine. Of course, if they change networks, I have to execute it again. Is there a way to allow all remote connections like I have experienced with SQL Server, or is this a bad idea for some reason? We have username and password still.. I'm obviously a little confused.



Also: this is a development database and is only accessible from our internal network. I understand why it is a bad idea to give everyone access to a production database.










share|improve this question






























    54















    I had been using SQL Server and am now using MySQL for a project. With SQL Server, our developers can connect to the remote database on their local machines if they know the host, username, password. With MySQL, though, to give a developer access from their local machines, I have been having to log in to MySQL and execute:



    GRANT ALL ON *.* to user@address IDENTIFIED BY 'password'; 
    flush privileges;


    Where address is the IP address of the developer's machine. Of course, if they change networks, I have to execute it again. Is there a way to allow all remote connections like I have experienced with SQL Server, or is this a bad idea for some reason? We have username and password still.. I'm obviously a little confused.



    Also: this is a development database and is only accessible from our internal network. I understand why it is a bad idea to give everyone access to a production database.










    share|improve this question


























      54












      54








      54


      36






      I had been using SQL Server and am now using MySQL for a project. With SQL Server, our developers can connect to the remote database on their local machines if they know the host, username, password. With MySQL, though, to give a developer access from their local machines, I have been having to log in to MySQL and execute:



      GRANT ALL ON *.* to user@address IDENTIFIED BY 'password'; 
      flush privileges;


      Where address is the IP address of the developer's machine. Of course, if they change networks, I have to execute it again. Is there a way to allow all remote connections like I have experienced with SQL Server, or is this a bad idea for some reason? We have username and password still.. I'm obviously a little confused.



      Also: this is a development database and is only accessible from our internal network. I understand why it is a bad idea to give everyone access to a production database.










      share|improve this question
















      I had been using SQL Server and am now using MySQL for a project. With SQL Server, our developers can connect to the remote database on their local machines if they know the host, username, password. With MySQL, though, to give a developer access from their local machines, I have been having to log in to MySQL and execute:



      GRANT ALL ON *.* to user@address IDENTIFIED BY 'password'; 
      flush privileges;


      Where address is the IP address of the developer's machine. Of course, if they change networks, I have to execute it again. Is there a way to allow all remote connections like I have experienced with SQL Server, or is this a bad idea for some reason? We have username and password still.. I'm obviously a little confused.



      Also: this is a development database and is only accessible from our internal network. I understand why it is a bad idea to give everyone access to a production database.







      mysql






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jun 16 '16 at 21:53







      stephen.hanson

















      asked Apr 19 '12 at 20:12









      stephen.hansonstephen.hanson

      5,58613749




      5,58613749






















          7 Answers
          7






          active

          oldest

          votes


















          135














          As pointed out by Ryan above, the command you need is



          GRANT ALL ON *.* to user@'%' IDENTIFIED BY 'password'; 


          However, note that the documentation indicates that in order for this to work, another user account from localhost must be created for the same user; otherwise, the anonymous account created automatically by mysql_install_db takes precedence because it has a more specific host column.



          In other words; in order for user user to be able to connect from any server; 2 accounts need to be created as follows:



          GRANT ALL ON *.* to user@localhost IDENTIFIED BY 'password'; 
          GRANT ALL ON *.* to user@'%' IDENTIFIED BY 'password';


          Read the full documentation here.



          And here's the relevant piece for reference:




          After connecting to the server as root, you can add new accounts. The
          following statements use GRANT to set up four new accounts:




          mysql> CREATE USER 'monty'@'localhost' IDENTIFIED BY 'some_pass';
          mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'localhost'
          -> WITH GRANT OPTION;
          mysql> CREATE USER 'monty'@'%' IDENTIFIED BY 'some_pass';
          mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'%'
          -> WITH GRANT OPTION;
          mysql> CREATE USER 'admin'@'localhost';
          mysql> GRANT RELOAD,PROCESS ON *.* TO 'admin'@'localhost';
          mysql> CREATE USER 'dummy'@'localhost';



          The accounts created by these statements have the following
          properties:



          Two of the accounts have a user name of monty and a password of
          some_pass. Both accounts are superuser accounts with full privileges
          to do anything. The 'monty'@'localhost' account can be used only when
          connecting from the local host. The 'monty'@'%' account uses the '%'
          wildcard for the host part, so it can be used to connect from any
          host.



          It is necessary to have both accounts for monty to be able to connect
          from anywhere as monty
          . Without the localhost account, the
          anonymous-user account for localhost that is created by
          mysql_install_db would take precedence when monty connects from the
          local host. As a result, monty would be treated as an anonymous user.
          The reason for this is that the anonymous-user account has a more
          specific Host column value than the 'monty'@'%' account and thus comes
          earlier in the user table sort order. (user table sorting is discussed
          in Section 6.2.4, “Access Control, Stage 1: Connection Verification”.)




          That seems silly to me unless I am misunderstanding this.






          share|improve this answer























          • Worked perfectly. Thanks!

            – stephen.hanson
            Apr 19 '12 at 20:51


















          21














          You can disable all security by editing /etc/my.cnf:



          [mysqld]
          skip-grant-tables





          share|improve this answer























          • good one! thanks! :)

            – Adrian
            May 22 '14 at 19:34











          • i like this one!

            – adbarads
            Jul 15 '14 at 15:55











          • this one cool, can be implement for test server

            – Anthony Kal
            May 7 at 9:49


















          11














          GRANT ALL ON *.* to user@'%' IDENTIFIED BY 'password'; 


          Will allow a specific user to log on from anywhere.



          It's bad because it removes some security control, i.e. if an account is compromised.






          share|improve this answer


















          • 2





            wish I could accept yours too. Thanks!

            – stephen.hanson
            Apr 19 '12 at 20:51






          • 3





            One more thing I had to do change was TCP bind interface. Since i had to connect to a mysql instance hosted in cloud , I changed "bind-address=0.0.0.0" in /etc/mysql/my.cnf , default is 127.0.0.1 where mysql listens only on local loopback interface and doesnt take calls from outside networks.

            – Abhijeet Apsunde
            Aug 10 '13 at 14:21












          • I have been struggling to figure out how to connect from anywhwere and these soltuions just helped me solve that initial problem. Many thanks but I have run into a different problem. I have tried to change the port number from 80 to 8080. Now, when I use servername:8080/mysite it quickly reverts back to servername/mysite gives a 404 - file or directory not found error. How do I make it work with port 8080? Great stuff

            – Kenny
            Feb 5 '18 at 16:27











          • @Kenny, create a new question

            – Nathan Basanese
            Mar 15 '18 at 2:49


















          8















          Install and setup mysql to connect from anywhere remotely DOES NOT
          WORK WITH mysql_secure_installation !

          (https://dev.mysql.com/doc/refman/5.5/en/mysql-secure-installation.html)




          On Ubuntu, Install mysql using:



          sudo apt-get install mysql-server


          Have just the below in /etc/mysql/my.cnf



          [mysqld]
          #### Unix socket settings (making localhost work)
          user = mysql
          pid-file = /var/run/mysqld/mysqld.pid
          socket = /var/run/mysqld/mysqld.sock

          #### TCP Socket settings (making all remote logins work)
          port = 3306
          bind-address = 0.0.0.0


          Login into DB from server using



          mysql -u root -p



          Create DB user using the below statement



          grant all privileges on *.* to ‘username’@‘%’ identified by ‘password’;


          Open firewall:



          sudo ufw allow 3306


          Restart mysql



          sudo service mysql restart





          share|improve this answer

























          • if anything, grant all privileges on *.* to 'username'@'%' identified by 'password';... but anyway doesn't work

            – Amit Kohli
            Jun 26 '17 at 10:49











          • sudo ufw allow 3306 This did the magic for me :)

            – Abhishek Goel
            Oct 21 '17 at 17:26











          • Most complete answer, thanks!

            – Joshua - Pendo
            Jan 6 '18 at 12:28


















          2














          Also you need to disable below line in configuration file:
          bind-address = 127.0.0.1






          share|improve this answer






























            1














            mysql> CREATE USER 'monty'@'192.168.%.%' IDENTIFIED BY 'some_pass';
            mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'192.168.%.%'





            share|improve this answer
































              1














              Mabey you only need:



              Step one:



              grant all privileges on *.* to 'user'@'IP' identified by 'password';


              or



              grant all privileges on *.* to 'user'@'%' identified by 'password';


              Step two:



              sudo ufw allow 3306


              Step three:



              sudo service mysql restart





              share|improve this answer

























                Your Answer






                StackExchange.ifUsing("editor", function ()
                StackExchange.using("externalEditor", function ()
                StackExchange.using("snippets", function ()
                StackExchange.snippets.init();
                );
                );
                , "code-snippets");

                StackExchange.ready(function()
                var channelOptions =
                tags: "".split(" "),
                id: "1"
                ;
                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%2fstackoverflow.com%2fquestions%2f10236000%2fallow-all-remote-connections-mysql%23new-answer', 'question_page');

                );

                Post as a guest















                Required, but never shown

























                7 Answers
                7






                active

                oldest

                votes








                7 Answers
                7






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes









                135














                As pointed out by Ryan above, the command you need is



                GRANT ALL ON *.* to user@'%' IDENTIFIED BY 'password'; 


                However, note that the documentation indicates that in order for this to work, another user account from localhost must be created for the same user; otherwise, the anonymous account created automatically by mysql_install_db takes precedence because it has a more specific host column.



                In other words; in order for user user to be able to connect from any server; 2 accounts need to be created as follows:



                GRANT ALL ON *.* to user@localhost IDENTIFIED BY 'password'; 
                GRANT ALL ON *.* to user@'%' IDENTIFIED BY 'password';


                Read the full documentation here.



                And here's the relevant piece for reference:




                After connecting to the server as root, you can add new accounts. The
                following statements use GRANT to set up four new accounts:




                mysql> CREATE USER 'monty'@'localhost' IDENTIFIED BY 'some_pass';
                mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'localhost'
                -> WITH GRANT OPTION;
                mysql> CREATE USER 'monty'@'%' IDENTIFIED BY 'some_pass';
                mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'%'
                -> WITH GRANT OPTION;
                mysql> CREATE USER 'admin'@'localhost';
                mysql> GRANT RELOAD,PROCESS ON *.* TO 'admin'@'localhost';
                mysql> CREATE USER 'dummy'@'localhost';



                The accounts created by these statements have the following
                properties:



                Two of the accounts have a user name of monty and a password of
                some_pass. Both accounts are superuser accounts with full privileges
                to do anything. The 'monty'@'localhost' account can be used only when
                connecting from the local host. The 'monty'@'%' account uses the '%'
                wildcard for the host part, so it can be used to connect from any
                host.



                It is necessary to have both accounts for monty to be able to connect
                from anywhere as monty
                . Without the localhost account, the
                anonymous-user account for localhost that is created by
                mysql_install_db would take precedence when monty connects from the
                local host. As a result, monty would be treated as an anonymous user.
                The reason for this is that the anonymous-user account has a more
                specific Host column value than the 'monty'@'%' account and thus comes
                earlier in the user table sort order. (user table sorting is discussed
                in Section 6.2.4, “Access Control, Stage 1: Connection Verification”.)




                That seems silly to me unless I am misunderstanding this.






                share|improve this answer























                • Worked perfectly. Thanks!

                  – stephen.hanson
                  Apr 19 '12 at 20:51















                135














                As pointed out by Ryan above, the command you need is



                GRANT ALL ON *.* to user@'%' IDENTIFIED BY 'password'; 


                However, note that the documentation indicates that in order for this to work, another user account from localhost must be created for the same user; otherwise, the anonymous account created automatically by mysql_install_db takes precedence because it has a more specific host column.



                In other words; in order for user user to be able to connect from any server; 2 accounts need to be created as follows:



                GRANT ALL ON *.* to user@localhost IDENTIFIED BY 'password'; 
                GRANT ALL ON *.* to user@'%' IDENTIFIED BY 'password';


                Read the full documentation here.



                And here's the relevant piece for reference:




                After connecting to the server as root, you can add new accounts. The
                following statements use GRANT to set up four new accounts:




                mysql> CREATE USER 'monty'@'localhost' IDENTIFIED BY 'some_pass';
                mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'localhost'
                -> WITH GRANT OPTION;
                mysql> CREATE USER 'monty'@'%' IDENTIFIED BY 'some_pass';
                mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'%'
                -> WITH GRANT OPTION;
                mysql> CREATE USER 'admin'@'localhost';
                mysql> GRANT RELOAD,PROCESS ON *.* TO 'admin'@'localhost';
                mysql> CREATE USER 'dummy'@'localhost';



                The accounts created by these statements have the following
                properties:



                Two of the accounts have a user name of monty and a password of
                some_pass. Both accounts are superuser accounts with full privileges
                to do anything. The 'monty'@'localhost' account can be used only when
                connecting from the local host. The 'monty'@'%' account uses the '%'
                wildcard for the host part, so it can be used to connect from any
                host.



                It is necessary to have both accounts for monty to be able to connect
                from anywhere as monty
                . Without the localhost account, the
                anonymous-user account for localhost that is created by
                mysql_install_db would take precedence when monty connects from the
                local host. As a result, monty would be treated as an anonymous user.
                The reason for this is that the anonymous-user account has a more
                specific Host column value than the 'monty'@'%' account and thus comes
                earlier in the user table sort order. (user table sorting is discussed
                in Section 6.2.4, “Access Control, Stage 1: Connection Verification”.)




                That seems silly to me unless I am misunderstanding this.






                share|improve this answer























                • Worked perfectly. Thanks!

                  – stephen.hanson
                  Apr 19 '12 at 20:51













                135












                135








                135







                As pointed out by Ryan above, the command you need is



                GRANT ALL ON *.* to user@'%' IDENTIFIED BY 'password'; 


                However, note that the documentation indicates that in order for this to work, another user account from localhost must be created for the same user; otherwise, the anonymous account created automatically by mysql_install_db takes precedence because it has a more specific host column.



                In other words; in order for user user to be able to connect from any server; 2 accounts need to be created as follows:



                GRANT ALL ON *.* to user@localhost IDENTIFIED BY 'password'; 
                GRANT ALL ON *.* to user@'%' IDENTIFIED BY 'password';


                Read the full documentation here.



                And here's the relevant piece for reference:




                After connecting to the server as root, you can add new accounts. The
                following statements use GRANT to set up four new accounts:




                mysql> CREATE USER 'monty'@'localhost' IDENTIFIED BY 'some_pass';
                mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'localhost'
                -> WITH GRANT OPTION;
                mysql> CREATE USER 'monty'@'%' IDENTIFIED BY 'some_pass';
                mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'%'
                -> WITH GRANT OPTION;
                mysql> CREATE USER 'admin'@'localhost';
                mysql> GRANT RELOAD,PROCESS ON *.* TO 'admin'@'localhost';
                mysql> CREATE USER 'dummy'@'localhost';



                The accounts created by these statements have the following
                properties:



                Two of the accounts have a user name of monty and a password of
                some_pass. Both accounts are superuser accounts with full privileges
                to do anything. The 'monty'@'localhost' account can be used only when
                connecting from the local host. The 'monty'@'%' account uses the '%'
                wildcard for the host part, so it can be used to connect from any
                host.



                It is necessary to have both accounts for monty to be able to connect
                from anywhere as monty
                . Without the localhost account, the
                anonymous-user account for localhost that is created by
                mysql_install_db would take precedence when monty connects from the
                local host. As a result, monty would be treated as an anonymous user.
                The reason for this is that the anonymous-user account has a more
                specific Host column value than the 'monty'@'%' account and thus comes
                earlier in the user table sort order. (user table sorting is discussed
                in Section 6.2.4, “Access Control, Stage 1: Connection Verification”.)




                That seems silly to me unless I am misunderstanding this.






                share|improve this answer













                As pointed out by Ryan above, the command you need is



                GRANT ALL ON *.* to user@'%' IDENTIFIED BY 'password'; 


                However, note that the documentation indicates that in order for this to work, another user account from localhost must be created for the same user; otherwise, the anonymous account created automatically by mysql_install_db takes precedence because it has a more specific host column.



                In other words; in order for user user to be able to connect from any server; 2 accounts need to be created as follows:



                GRANT ALL ON *.* to user@localhost IDENTIFIED BY 'password'; 
                GRANT ALL ON *.* to user@'%' IDENTIFIED BY 'password';


                Read the full documentation here.



                And here's the relevant piece for reference:




                After connecting to the server as root, you can add new accounts. The
                following statements use GRANT to set up four new accounts:




                mysql> CREATE USER 'monty'@'localhost' IDENTIFIED BY 'some_pass';
                mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'localhost'
                -> WITH GRANT OPTION;
                mysql> CREATE USER 'monty'@'%' IDENTIFIED BY 'some_pass';
                mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'%'
                -> WITH GRANT OPTION;
                mysql> CREATE USER 'admin'@'localhost';
                mysql> GRANT RELOAD,PROCESS ON *.* TO 'admin'@'localhost';
                mysql> CREATE USER 'dummy'@'localhost';



                The accounts created by these statements have the following
                properties:



                Two of the accounts have a user name of monty and a password of
                some_pass. Both accounts are superuser accounts with full privileges
                to do anything. The 'monty'@'localhost' account can be used only when
                connecting from the local host. The 'monty'@'%' account uses the '%'
                wildcard for the host part, so it can be used to connect from any
                host.



                It is necessary to have both accounts for monty to be able to connect
                from anywhere as monty
                . Without the localhost account, the
                anonymous-user account for localhost that is created by
                mysql_install_db would take precedence when monty connects from the
                local host. As a result, monty would be treated as an anonymous user.
                The reason for this is that the anonymous-user account has a more
                specific Host column value than the 'monty'@'%' account and thus comes
                earlier in the user table sort order. (user table sorting is discussed
                in Section 6.2.4, “Access Control, Stage 1: Connection Verification”.)




                That seems silly to me unless I am misunderstanding this.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Apr 19 '12 at 20:27









                IcarusIcarus

                55k1176107




                55k1176107












                • Worked perfectly. Thanks!

                  – stephen.hanson
                  Apr 19 '12 at 20:51

















                • Worked perfectly. Thanks!

                  – stephen.hanson
                  Apr 19 '12 at 20:51
















                Worked perfectly. Thanks!

                – stephen.hanson
                Apr 19 '12 at 20:51





                Worked perfectly. Thanks!

                – stephen.hanson
                Apr 19 '12 at 20:51













                21














                You can disable all security by editing /etc/my.cnf:



                [mysqld]
                skip-grant-tables





                share|improve this answer























                • good one! thanks! :)

                  – Adrian
                  May 22 '14 at 19:34











                • i like this one!

                  – adbarads
                  Jul 15 '14 at 15:55











                • this one cool, can be implement for test server

                  – Anthony Kal
                  May 7 at 9:49















                21














                You can disable all security by editing /etc/my.cnf:



                [mysqld]
                skip-grant-tables





                share|improve this answer























                • good one! thanks! :)

                  – Adrian
                  May 22 '14 at 19:34











                • i like this one!

                  – adbarads
                  Jul 15 '14 at 15:55











                • this one cool, can be implement for test server

                  – Anthony Kal
                  May 7 at 9:49













                21












                21








                21







                You can disable all security by editing /etc/my.cnf:



                [mysqld]
                skip-grant-tables





                share|improve this answer













                You can disable all security by editing /etc/my.cnf:



                [mysqld]
                skip-grant-tables






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Oct 1 '13 at 12:25









                David TinkerDavid Tinker

                5,45674580




                5,45674580












                • good one! thanks! :)

                  – Adrian
                  May 22 '14 at 19:34











                • i like this one!

                  – adbarads
                  Jul 15 '14 at 15:55











                • this one cool, can be implement for test server

                  – Anthony Kal
                  May 7 at 9:49

















                • good one! thanks! :)

                  – Adrian
                  May 22 '14 at 19:34











                • i like this one!

                  – adbarads
                  Jul 15 '14 at 15:55











                • this one cool, can be implement for test server

                  – Anthony Kal
                  May 7 at 9:49
















                good one! thanks! :)

                – Adrian
                May 22 '14 at 19:34





                good one! thanks! :)

                – Adrian
                May 22 '14 at 19:34













                i like this one!

                – adbarads
                Jul 15 '14 at 15:55





                i like this one!

                – adbarads
                Jul 15 '14 at 15:55













                this one cool, can be implement for test server

                – Anthony Kal
                May 7 at 9:49





                this one cool, can be implement for test server

                – Anthony Kal
                May 7 at 9:49











                11














                GRANT ALL ON *.* to user@'%' IDENTIFIED BY 'password'; 


                Will allow a specific user to log on from anywhere.



                It's bad because it removes some security control, i.e. if an account is compromised.






                share|improve this answer


















                • 2





                  wish I could accept yours too. Thanks!

                  – stephen.hanson
                  Apr 19 '12 at 20:51






                • 3





                  One more thing I had to do change was TCP bind interface. Since i had to connect to a mysql instance hosted in cloud , I changed "bind-address=0.0.0.0" in /etc/mysql/my.cnf , default is 127.0.0.1 where mysql listens only on local loopback interface and doesnt take calls from outside networks.

                  – Abhijeet Apsunde
                  Aug 10 '13 at 14:21












                • I have been struggling to figure out how to connect from anywhwere and these soltuions just helped me solve that initial problem. Many thanks but I have run into a different problem. I have tried to change the port number from 80 to 8080. Now, when I use servername:8080/mysite it quickly reverts back to servername/mysite gives a 404 - file or directory not found error. How do I make it work with port 8080? Great stuff

                  – Kenny
                  Feb 5 '18 at 16:27











                • @Kenny, create a new question

                  – Nathan Basanese
                  Mar 15 '18 at 2:49















                11














                GRANT ALL ON *.* to user@'%' IDENTIFIED BY 'password'; 


                Will allow a specific user to log on from anywhere.



                It's bad because it removes some security control, i.e. if an account is compromised.






                share|improve this answer


















                • 2





                  wish I could accept yours too. Thanks!

                  – stephen.hanson
                  Apr 19 '12 at 20:51






                • 3





                  One more thing I had to do change was TCP bind interface. Since i had to connect to a mysql instance hosted in cloud , I changed "bind-address=0.0.0.0" in /etc/mysql/my.cnf , default is 127.0.0.1 where mysql listens only on local loopback interface and doesnt take calls from outside networks.

                  – Abhijeet Apsunde
                  Aug 10 '13 at 14:21












                • I have been struggling to figure out how to connect from anywhwere and these soltuions just helped me solve that initial problem. Many thanks but I have run into a different problem. I have tried to change the port number from 80 to 8080. Now, when I use servername:8080/mysite it quickly reverts back to servername/mysite gives a 404 - file or directory not found error. How do I make it work with port 8080? Great stuff

                  – Kenny
                  Feb 5 '18 at 16:27











                • @Kenny, create a new question

                  – Nathan Basanese
                  Mar 15 '18 at 2:49













                11












                11








                11







                GRANT ALL ON *.* to user@'%' IDENTIFIED BY 'password'; 


                Will allow a specific user to log on from anywhere.



                It's bad because it removes some security control, i.e. if an account is compromised.






                share|improve this answer













                GRANT ALL ON *.* to user@'%' IDENTIFIED BY 'password'; 


                Will allow a specific user to log on from anywhere.



                It's bad because it removes some security control, i.e. if an account is compromised.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Apr 19 '12 at 20:15









                RyanRyan

                18.7k84881




                18.7k84881







                • 2





                  wish I could accept yours too. Thanks!

                  – stephen.hanson
                  Apr 19 '12 at 20:51






                • 3





                  One more thing I had to do change was TCP bind interface. Since i had to connect to a mysql instance hosted in cloud , I changed "bind-address=0.0.0.0" in /etc/mysql/my.cnf , default is 127.0.0.1 where mysql listens only on local loopback interface and doesnt take calls from outside networks.

                  – Abhijeet Apsunde
                  Aug 10 '13 at 14:21












                • I have been struggling to figure out how to connect from anywhwere and these soltuions just helped me solve that initial problem. Many thanks but I have run into a different problem. I have tried to change the port number from 80 to 8080. Now, when I use servername:8080/mysite it quickly reverts back to servername/mysite gives a 404 - file or directory not found error. How do I make it work with port 8080? Great stuff

                  – Kenny
                  Feb 5 '18 at 16:27











                • @Kenny, create a new question

                  – Nathan Basanese
                  Mar 15 '18 at 2:49












                • 2





                  wish I could accept yours too. Thanks!

                  – stephen.hanson
                  Apr 19 '12 at 20:51






                • 3





                  One more thing I had to do change was TCP bind interface. Since i had to connect to a mysql instance hosted in cloud , I changed "bind-address=0.0.0.0" in /etc/mysql/my.cnf , default is 127.0.0.1 where mysql listens only on local loopback interface and doesnt take calls from outside networks.

                  – Abhijeet Apsunde
                  Aug 10 '13 at 14:21












                • I have been struggling to figure out how to connect from anywhwere and these soltuions just helped me solve that initial problem. Many thanks but I have run into a different problem. I have tried to change the port number from 80 to 8080. Now, when I use servername:8080/mysite it quickly reverts back to servername/mysite gives a 404 - file or directory not found error. How do I make it work with port 8080? Great stuff

                  – Kenny
                  Feb 5 '18 at 16:27











                • @Kenny, create a new question

                  – Nathan Basanese
                  Mar 15 '18 at 2:49







                2




                2





                wish I could accept yours too. Thanks!

                – stephen.hanson
                Apr 19 '12 at 20:51





                wish I could accept yours too. Thanks!

                – stephen.hanson
                Apr 19 '12 at 20:51




                3




                3





                One more thing I had to do change was TCP bind interface. Since i had to connect to a mysql instance hosted in cloud , I changed "bind-address=0.0.0.0" in /etc/mysql/my.cnf , default is 127.0.0.1 where mysql listens only on local loopback interface and doesnt take calls from outside networks.

                – Abhijeet Apsunde
                Aug 10 '13 at 14:21






                One more thing I had to do change was TCP bind interface. Since i had to connect to a mysql instance hosted in cloud , I changed "bind-address=0.0.0.0" in /etc/mysql/my.cnf , default is 127.0.0.1 where mysql listens only on local loopback interface and doesnt take calls from outside networks.

                – Abhijeet Apsunde
                Aug 10 '13 at 14:21














                I have been struggling to figure out how to connect from anywhwere and these soltuions just helped me solve that initial problem. Many thanks but I have run into a different problem. I have tried to change the port number from 80 to 8080. Now, when I use servername:8080/mysite it quickly reverts back to servername/mysite gives a 404 - file or directory not found error. How do I make it work with port 8080? Great stuff

                – Kenny
                Feb 5 '18 at 16:27





                I have been struggling to figure out how to connect from anywhwere and these soltuions just helped me solve that initial problem. Many thanks but I have run into a different problem. I have tried to change the port number from 80 to 8080. Now, when I use servername:8080/mysite it quickly reverts back to servername/mysite gives a 404 - file or directory not found error. How do I make it work with port 8080? Great stuff

                – Kenny
                Feb 5 '18 at 16:27













                @Kenny, create a new question

                – Nathan Basanese
                Mar 15 '18 at 2:49





                @Kenny, create a new question

                – Nathan Basanese
                Mar 15 '18 at 2:49











                8















                Install and setup mysql to connect from anywhere remotely DOES NOT
                WORK WITH mysql_secure_installation !

                (https://dev.mysql.com/doc/refman/5.5/en/mysql-secure-installation.html)




                On Ubuntu, Install mysql using:



                sudo apt-get install mysql-server


                Have just the below in /etc/mysql/my.cnf



                [mysqld]
                #### Unix socket settings (making localhost work)
                user = mysql
                pid-file = /var/run/mysqld/mysqld.pid
                socket = /var/run/mysqld/mysqld.sock

                #### TCP Socket settings (making all remote logins work)
                port = 3306
                bind-address = 0.0.0.0


                Login into DB from server using



                mysql -u root -p



                Create DB user using the below statement



                grant all privileges on *.* to ‘username’@‘%’ identified by ‘password’;


                Open firewall:



                sudo ufw allow 3306


                Restart mysql



                sudo service mysql restart





                share|improve this answer

























                • if anything, grant all privileges on *.* to 'username'@'%' identified by 'password';... but anyway doesn't work

                  – Amit Kohli
                  Jun 26 '17 at 10:49











                • sudo ufw allow 3306 This did the magic for me :)

                  – Abhishek Goel
                  Oct 21 '17 at 17:26











                • Most complete answer, thanks!

                  – Joshua - Pendo
                  Jan 6 '18 at 12:28















                8















                Install and setup mysql to connect from anywhere remotely DOES NOT
                WORK WITH mysql_secure_installation !

                (https://dev.mysql.com/doc/refman/5.5/en/mysql-secure-installation.html)




                On Ubuntu, Install mysql using:



                sudo apt-get install mysql-server


                Have just the below in /etc/mysql/my.cnf



                [mysqld]
                #### Unix socket settings (making localhost work)
                user = mysql
                pid-file = /var/run/mysqld/mysqld.pid
                socket = /var/run/mysqld/mysqld.sock

                #### TCP Socket settings (making all remote logins work)
                port = 3306
                bind-address = 0.0.0.0


                Login into DB from server using



                mysql -u root -p



                Create DB user using the below statement



                grant all privileges on *.* to ‘username’@‘%’ identified by ‘password’;


                Open firewall:



                sudo ufw allow 3306


                Restart mysql



                sudo service mysql restart





                share|improve this answer

























                • if anything, grant all privileges on *.* to 'username'@'%' identified by 'password';... but anyway doesn't work

                  – Amit Kohli
                  Jun 26 '17 at 10:49











                • sudo ufw allow 3306 This did the magic for me :)

                  – Abhishek Goel
                  Oct 21 '17 at 17:26











                • Most complete answer, thanks!

                  – Joshua - Pendo
                  Jan 6 '18 at 12:28













                8












                8








                8








                Install and setup mysql to connect from anywhere remotely DOES NOT
                WORK WITH mysql_secure_installation !

                (https://dev.mysql.com/doc/refman/5.5/en/mysql-secure-installation.html)




                On Ubuntu, Install mysql using:



                sudo apt-get install mysql-server


                Have just the below in /etc/mysql/my.cnf



                [mysqld]
                #### Unix socket settings (making localhost work)
                user = mysql
                pid-file = /var/run/mysqld/mysqld.pid
                socket = /var/run/mysqld/mysqld.sock

                #### TCP Socket settings (making all remote logins work)
                port = 3306
                bind-address = 0.0.0.0


                Login into DB from server using



                mysql -u root -p



                Create DB user using the below statement



                grant all privileges on *.* to ‘username’@‘%’ identified by ‘password’;


                Open firewall:



                sudo ufw allow 3306


                Restart mysql



                sudo service mysql restart





                share|improve this answer
















                Install and setup mysql to connect from anywhere remotely DOES NOT
                WORK WITH mysql_secure_installation !

                (https://dev.mysql.com/doc/refman/5.5/en/mysql-secure-installation.html)




                On Ubuntu, Install mysql using:



                sudo apt-get install mysql-server


                Have just the below in /etc/mysql/my.cnf



                [mysqld]
                #### Unix socket settings (making localhost work)
                user = mysql
                pid-file = /var/run/mysqld/mysqld.pid
                socket = /var/run/mysqld/mysqld.sock

                #### TCP Socket settings (making all remote logins work)
                port = 3306
                bind-address = 0.0.0.0


                Login into DB from server using



                mysql -u root -p



                Create DB user using the below statement



                grant all privileges on *.* to ‘username’@‘%’ identified by ‘password’;


                Open firewall:



                sudo ufw allow 3306


                Restart mysql



                sudo service mysql restart






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Apr 2 at 10:10









                Didier Ghys

                27.6k96375




                27.6k96375










                answered Jun 20 '17 at 23:42









                Pugazendhi AsaimuthuPugazendhi Asaimuthu

                8111




                8111












                • if anything, grant all privileges on *.* to 'username'@'%' identified by 'password';... but anyway doesn't work

                  – Amit Kohli
                  Jun 26 '17 at 10:49











                • sudo ufw allow 3306 This did the magic for me :)

                  – Abhishek Goel
                  Oct 21 '17 at 17:26











                • Most complete answer, thanks!

                  – Joshua - Pendo
                  Jan 6 '18 at 12:28

















                • if anything, grant all privileges on *.* to 'username'@'%' identified by 'password';... but anyway doesn't work

                  – Amit Kohli
                  Jun 26 '17 at 10:49











                • sudo ufw allow 3306 This did the magic for me :)

                  – Abhishek Goel
                  Oct 21 '17 at 17:26











                • Most complete answer, thanks!

                  – Joshua - Pendo
                  Jan 6 '18 at 12:28
















                if anything, grant all privileges on *.* to 'username'@'%' identified by 'password';... but anyway doesn't work

                – Amit Kohli
                Jun 26 '17 at 10:49





                if anything, grant all privileges on *.* to 'username'@'%' identified by 'password';... but anyway doesn't work

                – Amit Kohli
                Jun 26 '17 at 10:49













                sudo ufw allow 3306 This did the magic for me :)

                – Abhishek Goel
                Oct 21 '17 at 17:26





                sudo ufw allow 3306 This did the magic for me :)

                – Abhishek Goel
                Oct 21 '17 at 17:26













                Most complete answer, thanks!

                – Joshua - Pendo
                Jan 6 '18 at 12:28





                Most complete answer, thanks!

                – Joshua - Pendo
                Jan 6 '18 at 12:28











                2














                Also you need to disable below line in configuration file:
                bind-address = 127.0.0.1






                share|improve this answer



























                  2














                  Also you need to disable below line in configuration file:
                  bind-address = 127.0.0.1






                  share|improve this answer

























                    2












                    2








                    2







                    Also you need to disable below line in configuration file:
                    bind-address = 127.0.0.1






                    share|improve this answer













                    Also you need to disable below line in configuration file:
                    bind-address = 127.0.0.1







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Apr 22 '15 at 14:06









                    Anıl ÖzselginAnıl Özselgin

                    21138




                    21138





















                        1














                        mysql> CREATE USER 'monty'@'192.168.%.%' IDENTIFIED BY 'some_pass';
                        mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'192.168.%.%'





                        share|improve this answer





























                          1














                          mysql> CREATE USER 'monty'@'192.168.%.%' IDENTIFIED BY 'some_pass';
                          mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'192.168.%.%'





                          share|improve this answer



























                            1












                            1








                            1







                            mysql> CREATE USER 'monty'@'192.168.%.%' IDENTIFIED BY 'some_pass';
                            mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'192.168.%.%'





                            share|improve this answer















                            mysql> CREATE USER 'monty'@'192.168.%.%' IDENTIFIED BY 'some_pass';
                            mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'192.168.%.%'






                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited Dec 2 '15 at 10:29









                            Roman Marusyk

                            12.7k123870




                            12.7k123870










                            answered Dec 2 '15 at 10:20









                            Mike MMike M

                            113




                            113





















                                1














                                Mabey you only need:



                                Step one:



                                grant all privileges on *.* to 'user'@'IP' identified by 'password';


                                or



                                grant all privileges on *.* to 'user'@'%' identified by 'password';


                                Step two:



                                sudo ufw allow 3306


                                Step three:



                                sudo service mysql restart





                                share|improve this answer





























                                  1














                                  Mabey you only need:



                                  Step one:



                                  grant all privileges on *.* to 'user'@'IP' identified by 'password';


                                  or



                                  grant all privileges on *.* to 'user'@'%' identified by 'password';


                                  Step two:



                                  sudo ufw allow 3306


                                  Step three:



                                  sudo service mysql restart





                                  share|improve this answer



























                                    1












                                    1








                                    1







                                    Mabey you only need:



                                    Step one:



                                    grant all privileges on *.* to 'user'@'IP' identified by 'password';


                                    or



                                    grant all privileges on *.* to 'user'@'%' identified by 'password';


                                    Step two:



                                    sudo ufw allow 3306


                                    Step three:



                                    sudo service mysql restart





                                    share|improve this answer















                                    Mabey you only need:



                                    Step one:



                                    grant all privileges on *.* to 'user'@'IP' identified by 'password';


                                    or



                                    grant all privileges on *.* to 'user'@'%' identified by 'password';


                                    Step two:



                                    sudo ufw allow 3306


                                    Step three:



                                    sudo service mysql restart






                                    share|improve this answer














                                    share|improve this answer



                                    share|improve this answer








                                    edited Mar 24 at 1:08

























                                    answered Mar 24 at 1:01









                                    Gregory SantanaGregory Santana

                                    412




                                    412



























                                        draft saved

                                        draft discarded
















































                                        Thanks for contributing an answer to Stack Overflow!


                                        • 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%2fstackoverflow.com%2fquestions%2f10236000%2fallow-all-remote-connections-mysql%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

                                        Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                                        Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                                        Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript