MySQL server not accessible from remote machine
I have installed MySQL server in my local Ubuntu server (11.10). I can't connect to the server from a remote machine.
When I tried:- nmap localhost
, It shows the following
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
139/tcp open netbios-ssn
445/tcp open microsoft-ds
631/tcp open ipp
3306/tcp open mysql
It means that 3306
, the MySQL port is open, right? But when I tried nmap 192.168.0.50
, which is the server IP, I get the following:-
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
139/tcp open netbios-ssn
445/tcp open microsoft-ds
Does this mean the port is not open when accessing using IP? If so, how do I open the port?
I had tried the following code, but looks like it didn't work.
sudo iptables -A INPUT -p tcp --dport 3306 -j ACCEPT
What is wrong here?
networking mysql firewall
add a comment |
I have installed MySQL server in my local Ubuntu server (11.10). I can't connect to the server from a remote machine.
When I tried:- nmap localhost
, It shows the following
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
139/tcp open netbios-ssn
445/tcp open microsoft-ds
631/tcp open ipp
3306/tcp open mysql
It means that 3306
, the MySQL port is open, right? But when I tried nmap 192.168.0.50
, which is the server IP, I get the following:-
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
139/tcp open netbios-ssn
445/tcp open microsoft-ds
Does this mean the port is not open when accessing using IP? If so, how do I open the port?
I had tried the following code, but looks like it didn't work.
sudo iptables -A INPUT -p tcp --dport 3306 -j ACCEPT
What is wrong here?
networking mysql firewall
add a comment |
I have installed MySQL server in my local Ubuntu server (11.10). I can't connect to the server from a remote machine.
When I tried:- nmap localhost
, It shows the following
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
139/tcp open netbios-ssn
445/tcp open microsoft-ds
631/tcp open ipp
3306/tcp open mysql
It means that 3306
, the MySQL port is open, right? But when I tried nmap 192.168.0.50
, which is the server IP, I get the following:-
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
139/tcp open netbios-ssn
445/tcp open microsoft-ds
Does this mean the port is not open when accessing using IP? If so, how do I open the port?
I had tried the following code, but looks like it didn't work.
sudo iptables -A INPUT -p tcp --dport 3306 -j ACCEPT
What is wrong here?
networking mysql firewall
I have installed MySQL server in my local Ubuntu server (11.10). I can't connect to the server from a remote machine.
When I tried:- nmap localhost
, It shows the following
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
139/tcp open netbios-ssn
445/tcp open microsoft-ds
631/tcp open ipp
3306/tcp open mysql
It means that 3306
, the MySQL port is open, right? But when I tried nmap 192.168.0.50
, which is the server IP, I get the following:-
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
139/tcp open netbios-ssn
445/tcp open microsoft-ds
Does this mean the port is not open when accessing using IP? If so, how do I open the port?
I had tried the following code, but looks like it didn't work.
sudo iptables -A INPUT -p tcp --dport 3306 -j ACCEPT
What is wrong here?
networking mysql firewall
networking mysql firewall
asked Jul 3 '12 at 11:04
SparkySparky
6113821
6113821
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Your MySQL service is bound to serve localhost only (interface binding). This is the default for security reasons. If you really need to access it directly from other hosts, there is a nice How to enable remote access to MySQL on Ubuntu which you could follow:
- as root, open your
/etc/mysql/my.cnf
or/etc/mysql/mysql.conf.d/mysqld.cnf
with your favorite editor, as on different systems it is found to be different. - look for the
[mysqld]
section, and in there for thebind-address
keyword. This usually is set to127.0.0.1
-- change that to match your "normal" IP-address - save the file, and reload the service (e.g. using
service mysql restart
)
Remember you must enable your remote users to access their database(s) from remote, by setting the appropriate GRANTs -- e.g.
GRANT ALL ON mydb.* TO remoteuser@'%' IDENTIFIED BY 'SomePASSWORD';
Note the @'%'
, which means "from any host".
Glad to read -- and you're welcome!
– Izzy
Jul 4 '12 at 10:53
link is broken :(
– dino
Jun 24 '13 at 21:44
2
@dino No longer. I fixed that and also included an excerpt, so if it dies again the steps required are still here. My bad I didn't do so from the beginning -- but as you can see from the timestamp, that was one of my early answers. We all learn :)
– Izzy
Jun 24 '13 at 22:58
2
The bind-address field was under/etc/mysql/mysql.conf.d/mysqld.cnf
for my system.
– Eric G
Sep 8 '17 at 19:11
@EricG Thanks for the pointer. My answer was 5 years ago, so configs have changed a little (and probably made more modular).
– Izzy
Sep 8 '17 at 19:13
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f159053%2fmysql-server-not-accessible-from-remote-machine%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Your MySQL service is bound to serve localhost only (interface binding). This is the default for security reasons. If you really need to access it directly from other hosts, there is a nice How to enable remote access to MySQL on Ubuntu which you could follow:
- as root, open your
/etc/mysql/my.cnf
or/etc/mysql/mysql.conf.d/mysqld.cnf
with your favorite editor, as on different systems it is found to be different. - look for the
[mysqld]
section, and in there for thebind-address
keyword. This usually is set to127.0.0.1
-- change that to match your "normal" IP-address - save the file, and reload the service (e.g. using
service mysql restart
)
Remember you must enable your remote users to access their database(s) from remote, by setting the appropriate GRANTs -- e.g.
GRANT ALL ON mydb.* TO remoteuser@'%' IDENTIFIED BY 'SomePASSWORD';
Note the @'%'
, which means "from any host".
Glad to read -- and you're welcome!
– Izzy
Jul 4 '12 at 10:53
link is broken :(
– dino
Jun 24 '13 at 21:44
2
@dino No longer. I fixed that and also included an excerpt, so if it dies again the steps required are still here. My bad I didn't do so from the beginning -- but as you can see from the timestamp, that was one of my early answers. We all learn :)
– Izzy
Jun 24 '13 at 22:58
2
The bind-address field was under/etc/mysql/mysql.conf.d/mysqld.cnf
for my system.
– Eric G
Sep 8 '17 at 19:11
@EricG Thanks for the pointer. My answer was 5 years ago, so configs have changed a little (and probably made more modular).
– Izzy
Sep 8 '17 at 19:13
add a comment |
Your MySQL service is bound to serve localhost only (interface binding). This is the default for security reasons. If you really need to access it directly from other hosts, there is a nice How to enable remote access to MySQL on Ubuntu which you could follow:
- as root, open your
/etc/mysql/my.cnf
or/etc/mysql/mysql.conf.d/mysqld.cnf
with your favorite editor, as on different systems it is found to be different. - look for the
[mysqld]
section, and in there for thebind-address
keyword. This usually is set to127.0.0.1
-- change that to match your "normal" IP-address - save the file, and reload the service (e.g. using
service mysql restart
)
Remember you must enable your remote users to access their database(s) from remote, by setting the appropriate GRANTs -- e.g.
GRANT ALL ON mydb.* TO remoteuser@'%' IDENTIFIED BY 'SomePASSWORD';
Note the @'%'
, which means "from any host".
Glad to read -- and you're welcome!
– Izzy
Jul 4 '12 at 10:53
link is broken :(
– dino
Jun 24 '13 at 21:44
2
@dino No longer. I fixed that and also included an excerpt, so if it dies again the steps required are still here. My bad I didn't do so from the beginning -- but as you can see from the timestamp, that was one of my early answers. We all learn :)
– Izzy
Jun 24 '13 at 22:58
2
The bind-address field was under/etc/mysql/mysql.conf.d/mysqld.cnf
for my system.
– Eric G
Sep 8 '17 at 19:11
@EricG Thanks for the pointer. My answer was 5 years ago, so configs have changed a little (and probably made more modular).
– Izzy
Sep 8 '17 at 19:13
add a comment |
Your MySQL service is bound to serve localhost only (interface binding). This is the default for security reasons. If you really need to access it directly from other hosts, there is a nice How to enable remote access to MySQL on Ubuntu which you could follow:
- as root, open your
/etc/mysql/my.cnf
or/etc/mysql/mysql.conf.d/mysqld.cnf
with your favorite editor, as on different systems it is found to be different. - look for the
[mysqld]
section, and in there for thebind-address
keyword. This usually is set to127.0.0.1
-- change that to match your "normal" IP-address - save the file, and reload the service (e.g. using
service mysql restart
)
Remember you must enable your remote users to access their database(s) from remote, by setting the appropriate GRANTs -- e.g.
GRANT ALL ON mydb.* TO remoteuser@'%' IDENTIFIED BY 'SomePASSWORD';
Note the @'%'
, which means "from any host".
Your MySQL service is bound to serve localhost only (interface binding). This is the default for security reasons. If you really need to access it directly from other hosts, there is a nice How to enable remote access to MySQL on Ubuntu which you could follow:
- as root, open your
/etc/mysql/my.cnf
or/etc/mysql/mysql.conf.d/mysqld.cnf
with your favorite editor, as on different systems it is found to be different. - look for the
[mysqld]
section, and in there for thebind-address
keyword. This usually is set to127.0.0.1
-- change that to match your "normal" IP-address - save the file, and reload the service (e.g. using
service mysql restart
)
Remember you must enable your remote users to access their database(s) from remote, by setting the appropriate GRANTs -- e.g.
GRANT ALL ON mydb.* TO remoteuser@'%' IDENTIFIED BY 'SomePASSWORD';
Note the @'%'
, which means "from any host".
edited Jan 26 at 16:58
Pablo Bianchi
2,79821533
2,79821533
answered Jul 3 '12 at 11:20
IzzyIzzy
2,84241847
2,84241847
Glad to read -- and you're welcome!
– Izzy
Jul 4 '12 at 10:53
link is broken :(
– dino
Jun 24 '13 at 21:44
2
@dino No longer. I fixed that and also included an excerpt, so if it dies again the steps required are still here. My bad I didn't do so from the beginning -- but as you can see from the timestamp, that was one of my early answers. We all learn :)
– Izzy
Jun 24 '13 at 22:58
2
The bind-address field was under/etc/mysql/mysql.conf.d/mysqld.cnf
for my system.
– Eric G
Sep 8 '17 at 19:11
@EricG Thanks for the pointer. My answer was 5 years ago, so configs have changed a little (and probably made more modular).
– Izzy
Sep 8 '17 at 19:13
add a comment |
Glad to read -- and you're welcome!
– Izzy
Jul 4 '12 at 10:53
link is broken :(
– dino
Jun 24 '13 at 21:44
2
@dino No longer. I fixed that and also included an excerpt, so if it dies again the steps required are still here. My bad I didn't do so from the beginning -- but as you can see from the timestamp, that was one of my early answers. We all learn :)
– Izzy
Jun 24 '13 at 22:58
2
The bind-address field was under/etc/mysql/mysql.conf.d/mysqld.cnf
for my system.
– Eric G
Sep 8 '17 at 19:11
@EricG Thanks for the pointer. My answer was 5 years ago, so configs have changed a little (and probably made more modular).
– Izzy
Sep 8 '17 at 19:13
Glad to read -- and you're welcome!
– Izzy
Jul 4 '12 at 10:53
Glad to read -- and you're welcome!
– Izzy
Jul 4 '12 at 10:53
link is broken :(
– dino
Jun 24 '13 at 21:44
link is broken :(
– dino
Jun 24 '13 at 21:44
2
2
@dino No longer. I fixed that and also included an excerpt, so if it dies again the steps required are still here. My bad I didn't do so from the beginning -- but as you can see from the timestamp, that was one of my early answers. We all learn :)
– Izzy
Jun 24 '13 at 22:58
@dino No longer. I fixed that and also included an excerpt, so if it dies again the steps required are still here. My bad I didn't do so from the beginning -- but as you can see from the timestamp, that was one of my early answers. We all learn :)
– Izzy
Jun 24 '13 at 22:58
2
2
The bind-address field was under
/etc/mysql/mysql.conf.d/mysqld.cnf
for my system.– Eric G
Sep 8 '17 at 19:11
The bind-address field was under
/etc/mysql/mysql.conf.d/mysqld.cnf
for my system.– Eric G
Sep 8 '17 at 19:11
@EricG Thanks for the pointer. My answer was 5 years ago, so configs have changed a little (and probably made more modular).
– Izzy
Sep 8 '17 at 19:13
@EricG Thanks for the pointer. My answer was 5 years ago, so configs have changed a little (and probably made more modular).
– Izzy
Sep 8 '17 at 19:13
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f159053%2fmysql-server-not-accessible-from-remote-machine%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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