Kubernetes mariadb user login

3/11/2020

I am fairly new to the system. Fortunately Google cloud plateform has a one click setup for master slave mariadb replication which i opted or(https://console.cloud.google.com/marketplace/details/google/mariadb?q=mariadb).
After which I could login in as root and create a user. I ran the following sql command.

create user 'user'@'localhost' identified by 'password';

After sucessfully creating the user, If i am inside either master or slave pod i could login in local instance but I could not login from outside those pods or from one pod to another pod in mariadb instances.For loggin I used the following command

mysql -u user -h mariadb-1-mariadb.mariadb.svc.cluster.local -p

where mariadb-1-mariadb = service and mariadb=namespace

I keep on getting error.
Error 1045(2800): Access denied for the user
Any help is greatly appreciated. I think you might want to read the yaml file on gcp if you are to think about port blocking but I think it shouldn't be that issue.

-- bedrockelectro
kubernetes
mariadb
mysql

1 Answer

3/12/2020

I had issue in creating user. When I tried to login as user, it used to somehow pick up my container ip I am trying to login from. All I needed to do was make user not local host but global with '%' and that solved the issue.

create user 'user'@'%' identified by 'password';
-- bedrockelectro
Source: StackOverflow