![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| ||||
| ||||
|
|
I'm trying out MariaDB and I have a problem granting access to a user (that connects through JDBC). Here is what I did (connected as root): CREATE DATABASE hans; CREATE USER hans identified by 'secretpassword'; Here I would expect you should use 'hans'@'localhost', not just "hans". |
|
GRANT ALL ON hans.* TO 'hans'@'localhost'; But when I connect as hans to the database hans I get the error message: Access denied for user 'thomas'@'localhost' (using password: YES) ^^^^^^ |
|
(I am using the correct password) but the wrong username, apparently. |
|
I also tried GRANT ALL ON hans.* TO 'hans'@'%' instead but that didn't change anything. What am I missing? Is MariaDB different in this regard to MySQL? |
#3
| |||
| |||
|
|
CREATE USER hans identified by 'secretpassword'; Here I would expect you should use 'hans'@'localhost', not just "hans". |
|
You are apparently *NOT* connecting as 'hans@localhost', you are connecting as 'thomas@localhost'. This might indicate some problems with JDBC code where you establish the connection. |
#4
| |||
| |||
|
|
CREATE USER hans identified by 'secretpassword'; Here I would expect you should use 'hans'@'localhost', not just "hans". Hmm, my understanding was that this would be the same, but after changing it, it did work. (I find this whole @localhost thing pretty confusing, but I'll get used to it I guess...) |
#5
| |||
| |||
|
|
CREATE USER hans identified by 'secretpassword'; Here I would expect you should use 'hans'@'localhost', not just "hans". Hmm, my understanding was that this would be the same, but after changing it, it did work. (I find this whole @localhost thing pretty confusing, but I'll get used to it I guess...) It gets worse. Wait until you find out that 'localhost' and '127.0.0.1' aren't referring to the same thing. (; |
#6
| |||
| |||
|
|
It gets worse than that. Wait until you find out that "LocalHost", "locaLhost", "LOCALHOST", "localhosT" and lOcalhOst" refer to the same thing, but "localhost" is different. |
BI (both|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~| Malcolm Hoar "The more I practice, the luckier I get". | malch (AT) malch (DOT) com Gary Player. | http://www.malch.com/ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~ |
#7
| ||||||
| ||||||
|
|
gordonb.s4muw (AT) burditt (DOT) org (Gordon Burditt) wrote: It gets worse than that. Wait until you find out that "LocalHost", "locaLhost", "LOCALHOST", "localhosT" and lOcalhOst" refer to the same thing, but "localhost" is different. LOL. I din't know that |
|
but I am irritated by the fact that I need to allow for: "user"@"localhost" |
|
"user"@"127.0.0.1" "user"@"xxx.xxx.xxx.xxx" # My real IP "user"@"myhost.mydomain.com" |
|
Whether I'm seen as "localhost" or "myhost.mydomain.com" depends on exactly how I make the connection. |
|
It's different depending on whether I use MySQL Workshop or Perl: BI (bothvia an SSH tunnel). |
|
And I feel it's necessary to cover the IP's in case of any lookup failures. |
#8
| |||
| |||
|
|
It's different depending on whether I use MySQL Workshop or Perl: BI (bothvia an SSH tunnel). For a tunneled connection it depends completely on how *you* configure the tunnel. The client application does not matter at all. If you use multiple tunnels with different configuration then it's completely your fault. |
BI and MySQL Workshop from the same client|
And I feel it's necessary to cover the IP's in case of any lookup failures. In fact it's recommended to turn off DNS lookups in MySQL and use IP addresses only (in production environments). |
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~| Malcolm Hoar "The more I practice, the luckier I get". | malch (AT) malch (DOT) com Gary Player. | http://www.malch.com/ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~ |
#9
| |||
| |||
|
|
malch (AT) malch (DOT) com (Malcolm Hoar) wrote: gordonb.s4muw (AT) burditt (DOT) org (Gordon Burditt) wrote: It gets worse than that. Wait until you find out that "LocalHost", "locaLhost", "LOCALHOST", "localhosT" and lOcalhOst" refer to the same thing, but "localhost" is different. LOL. I din't know that Is it really *that* hard to read the manual and to understand that "localhost" (in exactly that spelling) is treated special and means "connect through local transport" ? |
#10
| |||
| |||
|
|
axel.schwenke (AT) gmx (DOT) de wrote: For a tunneled connection it depends completely on how *you* configure the tunnel. The client application does not matter at all. If you use multiple tunnels with different configuration then it's completely your fault. I think not. In my case, I had only configured a single tunnel. But to use Perl: BI and MySQL Workshop from the same clientwith the same tunnel required me to allow for localhost as well as the real hostname. |
|
In fact it's recommended to turn off DNS lookups in MySQL and use IP addresses only (in production environments). Now, this makes sense and I contemplated doing just that. But my Googling didn't suggest that this was a common practise let alone a recommended one. A post in the MySQL forum went unanswered. |
![]() |
| Thread Tools | |
| Display Modes | |
| |