MariaDB on Docker Linux have two different version between external/internal IP
up vote
0
down vote
favorite
- I ran MariaDB as Docker - expose port 3306 to localhost:3307
Connect Database via localhost:3307
$ mysql -u tvgift -P 3307 -h localhost -p
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
+--------------------+
1 row in set (0.00 sec)
Connect Database via 172.18.0.2:3306 (IP I got from
$ docker inspect <docker ID>
$ mysql -u tvgift -P 3306 -h 172.18.0.2 -p
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| tvgift |
+--------------------+
2 rows in set (0.00 sec)
I tried another client (Using mycli) with both IP, result is same.
$ mycli mysql://tvgift:tvgift@localhost:3307/tvgift
mariadb tvgift@localhost:tvgift> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| tvgift |
+--------------------+
2 rows in set
Time: 0.013s
$ mycli mysql://tvgift:tvgift@172.18.0.2:3306/tvgift
mariadb tvgift@172.18.0.2:tvgift> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| tvgift |
+--------------------+
2 rows in set
Time: 0.013s
So, only mysql client have differ between two IP of one container service, can you tell me why?
mysql docker mariadb
add a comment |
up vote
0
down vote
favorite
- I ran MariaDB as Docker - expose port 3306 to localhost:3307
Connect Database via localhost:3307
$ mysql -u tvgift -P 3307 -h localhost -p
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
+--------------------+
1 row in set (0.00 sec)
Connect Database via 172.18.0.2:3306 (IP I got from
$ docker inspect <docker ID>
$ mysql -u tvgift -P 3306 -h 172.18.0.2 -p
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| tvgift |
+--------------------+
2 rows in set (0.00 sec)
I tried another client (Using mycli) with both IP, result is same.
$ mycli mysql://tvgift:tvgift@localhost:3307/tvgift
mariadb tvgift@localhost:tvgift> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| tvgift |
+--------------------+
2 rows in set
Time: 0.013s
$ mycli mysql://tvgift:tvgift@172.18.0.2:3306/tvgift
mariadb tvgift@172.18.0.2:tvgift> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| tvgift |
+--------------------+
2 rows in set
Time: 0.013s
So, only mysql client have differ between two IP of one container service, can you tell me why?
mysql docker mariadb
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
- I ran MariaDB as Docker - expose port 3306 to localhost:3307
Connect Database via localhost:3307
$ mysql -u tvgift -P 3307 -h localhost -p
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
+--------------------+
1 row in set (0.00 sec)
Connect Database via 172.18.0.2:3306 (IP I got from
$ docker inspect <docker ID>
$ mysql -u tvgift -P 3306 -h 172.18.0.2 -p
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| tvgift |
+--------------------+
2 rows in set (0.00 sec)
I tried another client (Using mycli) with both IP, result is same.
$ mycli mysql://tvgift:tvgift@localhost:3307/tvgift
mariadb tvgift@localhost:tvgift> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| tvgift |
+--------------------+
2 rows in set
Time: 0.013s
$ mycli mysql://tvgift:tvgift@172.18.0.2:3306/tvgift
mariadb tvgift@172.18.0.2:tvgift> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| tvgift |
+--------------------+
2 rows in set
Time: 0.013s
So, only mysql client have differ between two IP of one container service, can you tell me why?
mysql docker mariadb
- I ran MariaDB as Docker - expose port 3306 to localhost:3307
Connect Database via localhost:3307
$ mysql -u tvgift -P 3307 -h localhost -p
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
+--------------------+
1 row in set (0.00 sec)
Connect Database via 172.18.0.2:3306 (IP I got from
$ docker inspect <docker ID>
$ mysql -u tvgift -P 3306 -h 172.18.0.2 -p
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| tvgift |
+--------------------+
2 rows in set (0.00 sec)
I tried another client (Using mycli) with both IP, result is same.
$ mycli mysql://tvgift:tvgift@localhost:3307/tvgift
mariadb tvgift@localhost:tvgift> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| tvgift |
+--------------------+
2 rows in set
Time: 0.013s
$ mycli mysql://tvgift:tvgift@172.18.0.2:3306/tvgift
mariadb tvgift@172.18.0.2:tvgift> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| tvgift |
+--------------------+
2 rows in set
Time: 0.013s
So, only mysql client have differ between two IP of one container service, can you tell me why?
mysql docker mariadb
mysql docker mariadb
asked Nov 20 at 4:27
Tien Hoang
1911213
1911213
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
localhost
!= any IP address. That is,
GRANT ... TO tvgift@'%' ...
does not include
GRANT ... TO tvgift@'localhost' ...
If you want to connect both via localhost
and via an IP address or hostname, you must provide two GRANTs
with the same permissions (such as ON tvgift.*
).
You're right. Thank you so much!
– Tien Hoang
Nov 23 at 15:57
add a comment |
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
});
}
});
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%2fstackoverflow.com%2fquestions%2f53386231%2fmariadb-on-docker-linux-have-two-different-version-between-external-internal-ip%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
up vote
1
down vote
accepted
localhost
!= any IP address. That is,
GRANT ... TO tvgift@'%' ...
does not include
GRANT ... TO tvgift@'localhost' ...
If you want to connect both via localhost
and via an IP address or hostname, you must provide two GRANTs
with the same permissions (such as ON tvgift.*
).
You're right. Thank you so much!
– Tien Hoang
Nov 23 at 15:57
add a comment |
up vote
1
down vote
accepted
localhost
!= any IP address. That is,
GRANT ... TO tvgift@'%' ...
does not include
GRANT ... TO tvgift@'localhost' ...
If you want to connect both via localhost
and via an IP address or hostname, you must provide two GRANTs
with the same permissions (such as ON tvgift.*
).
You're right. Thank you so much!
– Tien Hoang
Nov 23 at 15:57
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
localhost
!= any IP address. That is,
GRANT ... TO tvgift@'%' ...
does not include
GRANT ... TO tvgift@'localhost' ...
If you want to connect both via localhost
and via an IP address or hostname, you must provide two GRANTs
with the same permissions (such as ON tvgift.*
).
localhost
!= any IP address. That is,
GRANT ... TO tvgift@'%' ...
does not include
GRANT ... TO tvgift@'localhost' ...
If you want to connect both via localhost
and via an IP address or hostname, you must provide two GRANTs
with the same permissions (such as ON tvgift.*
).
answered Nov 20 at 16:29
Rick James
65.5k55796
65.5k55796
You're right. Thank you so much!
– Tien Hoang
Nov 23 at 15:57
add a comment |
You're right. Thank you so much!
– Tien Hoang
Nov 23 at 15:57
You're right. Thank you so much!
– Tien Hoang
Nov 23 at 15:57
You're right. Thank you so much!
– Tien Hoang
Nov 23 at 15:57
add a comment |
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.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- 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%2fstackoverflow.com%2fquestions%2f53386231%2fmariadb-on-docker-linux-have-two-different-version-between-external-internal-ip%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