Trying to connect with mySql on Grafana by Bitnami (running on AWS) and can`t login with credentials

Keywords: MySQL - AWS - Technical issue - Credentials
bnsupport ID: aa9cdd53-0e16-7c29-c9f1-2f7ba878d3c7
Description:
I am remotely logging into my EC2 instance running grafana by bitnami:
The default username and password is ‘admin’ and ‘XXXXXXXXX’.

According to bitnami docs I should use these credentials (password at least) to login into the mySql database so I can create a new database I am going to use as data source.

test -d /opt/bitnami/mariadb && echo "MariaDB" || echo "MySQL"
mysql

mysql -u root -p (either using root or admin with my credentials)
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/opt/bitnami/mysql/tmp/mysql.sock' (2)

Hi @ClaudioBaldo,

Thank you for using Bitnami. You need to use “root” and the password you obtain from the credentials file to access the database.

mysql -u root -pYOUR_PASSWORD_HERE

Note: There is not an extra space between the -p option and the password. You can also run mysql -u root -p and then paste the command when the CLI asks for it.

Happy to help!


Was my answer helpful? Click on :heart:

hi jota, what credentials should I use? I am ssh into the AWS instance running grafana with a key-pair, once I am logged is I check:

$ cat bitnami_credentials

Welcome to the Bitnami Grafana Stack
******************************************************************************
The default username and password is 'admin' and 'MY_PASSWORD_HERE'.
******************************************************************************
You can also use this password to access the databases and any other component the stack includes.
Please refer to https://docs.bitnami.com/ for more details.

I have tried to use that password and still the same result, either if I add the password after the CLI request it, or if I include it without the space as you have advised.
Still getting the error:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/opt/bitnami/mysql/tmp/mysql.sock' (2)

so I assume I am using the wrong password, but don`t know where/how to find the right one.

also if I open the /etc/mysql folder I find:
conf.d mariadb.cnf mariadb.conf.d my.cnf my.cnf.fallback
no trace of logs from mysql.

I think someone from my team may have installed a newer version of mysql on this machine which is possibly creating issues with the mysql for grafana?
Is this something you can check from your side to validate this?
Possibly they may have modified the credentials for accessing the db?

hi @ClaudioBaldo,

It seems MySQL is not running in the instance and that’s why you can’t access it. It’s not monitored either so let’s take a look at the configuration. Can you run these commands?

sudo ls -la /etc/monit/conf.d/
sudo gonit status

Thanks

@jota see below…

bitnami@xxxxxxxxx:~$ sudo ls -la /etc/monit/conf.d/
ls: cannot access '/etc/monit/conf.d/': No such file or directory

bitnami@XXXXXXXXX:~$ sudo gonit status

Uptime                         299h20m51s
Last Check                     2021-04-20 13:18:30.781340112 +0000 UTC m=+1077601.886502541
Next Check                     2021-04-20 13:20:30.781340112 +0000 UTC m=+1077721.886502541
Pid                            738
Pid File                       /var/run/gonit.pid
Control File                   /etc/gonit/gonitrc
Socket File                    /var/run/gonit.sock
Log File                       /var/log/gonit.log
Process 'grafana'
  monitoring status                        Not monitored

Hi @ClaudioBaldo,

Sorry for the delay here. I just launched a fresh Bitnami Grafana instance and confirmed that the solution doesn’t include the MySQL server. We include the client and the required libraries for the application to connect to an external MySQL database but the server is not included in the instance and that’s why you can’t access the database using mysql -u root -p. You will need to use an external database to be able to store the data.

I hope this info helps.

ok, can we install a different sql database in the instance?
We would need to have data stored locally as a reference table for grafana

Hi @ClaudioBaldo,

You can install the MySQL server using the apt and then access that database from the application.

@jota we are using an external mysql server now.
no need to go through this. Thanks