MySQL Config showing access denied but not user in config

I’m having to set up a new server and our config file looks like this;

"DriverName": "mysql",
"DataSource": "mysql://custom_mmuser:Password@tcp(127.0.0.1:3306)/custom_mattermost_db?sslmode=disable\u0026connect_timeout=10",

I’m getting this error when we run the server;

Failed to ping DB","error":"Error 1045: Access denied for user 'mysql'@'localhost' (using password: YES)","retrying in seconds":10}

The odd thing is the username “mysql@localhost” does not match and nothing I do in the config file get mattermost to recognize the right username or IP.

It almost seems like it is not reading the right config file but everytime I run mattermost.exe it updates the config file and I have to reload the changes.

What am I doing wrong?

Hello, @GChester

The format of DataSource when you are using MySQL should look like this:

"DataSource": "custom_mmuser:Password@tcp(127.0.0.1:3306)/custom_mattermost_db?charset=utf8mb4,utf8\u0026readTimeout=30s\u0026writeTimeout=30s"

The one that you shared looks more like the PostgreSQL. Can you please make the necessary changes and let me know if it works properly on your end?

2 Likes

@ahmaddanial is totally right. I have had the same issues because of Mattermost’s tutorial here: Configuration in the Mattermost Database — Mattermost 5.37 documentation

They say it should look like mysql:// but that’s only needed in the environment file (if you use it). Took me some time to figure this out. Thanks again @ahmaddanial !

1 Like

Hi, @crypt0jan

You are most welcome. Any time!

Hi @dannymohammad , I see some of your contributions there, but I cannot seem to understand what needs to be changed. Here is sql syntax:

SqlSettings": {
“DriverName”: “mysql”,
“DataSource”: “mmuser:Ghdyhtyhr6757!@tcp(127.0.0.1:3306)/custom_mattermost_db?sslmode=disable\u0026connect_timeout=10\u0026binary_parameters=yes”,

Please help me here.

Hi @fkengne and welcome to the Mattermost forums!

Can you please describe what you’re trying to do? Do you have an already working Mattermost installation and are you trying to move the database to a different systerm? Are you trying to convert from one installation method to another one (binary to docker, docker to binary, etc.) or are you in the process of initially setting up a Mattermost server and if so, what deployment model did you choose?

I was able to get it up and running. I am now just dealing with the SSL. Following the KB while doing the SSL, it is required to have nginx proxy running. Can we get an ssl without it?
Thanks,

Yes, but to help you with that I also need to know what deployment type you’re using, otherwise I can just say that you can configure that in the System Console’s “Web Server” category:

If you need help with that, please create a new topic since this has nothing to do with the initial MySQL issue in here.

Yep. All tutorials from Mattermost do not make clear to remove the mysql:// nor to add @tcp(127.0.0.1:3306) in place of localhost/

This finally solved it.

Hi compumatter,

can you list some of the tutorials you found that do not mention that? I just clicked a bit through the offiical documentation (f.ex. Install Mattermost server from a tarball — Mattermost documentation) and all of them have this documented: