Cannot connect to the DB
jonnypaes
FREEOP

a month ago

Hello, I'm having this problem, but I did everything right (I guess). Does anyone know how to fix this?:

(PS. I've tried variables like "${{MYSQLROOTPASSWORD}}" and the actual values, but it didn't work either)

The repo.
https://github.com/jonnypaes/rascunho_hospital

It works normally on local docker. Can anyone help me out?

Error below (To make it easier to other people with the same problem to search:

❌ DB connection failed Error: Access denied for user 'root'@'10.186.220.72' (using password: YES) at Packet.asError (/app/node_modules/mysql2/lib/packets/packet.js:739:17) at ClientHandshake.execute (/app/node_modules/mysql2/lib/commands/command.js:29:26) at PoolConnection.handlePacket (/app/node_modules/mysql2/lib/base/connection.js:508:34) at PacketParser.onPacket (/app/node_modules/mysql2/lib/base/connection.js:93:12) at PacketParser.executeStart (/app/node_modules/mysql2/lib/packet_parser.js:75:16) at Socket. (/app/node_modules/mysql2/lib/base/connection.js:100:25) at Socket.emit (node:events:517:28) at addChunk (node:internal/streams/readable:368:12) at readableAddChunk (node:internal/streams/readable:341:9) at Readable.push (node:internal/streams/readable:278:10) { code: 'ER_ACCESS_DENIED_ERROR', errno: 1045, sqlState: '28000', sqlMessage: "Access denied for user 'root'@'10.186.220.72' (using password: YES)", sql: undefined }

Solved

13 Replies

a month ago

Can you show how your are referencing the variables? For example, something like this:

DB_HOST="${{MariaDB.MARIADB_HOST}}"
DB_NAME="${{MariaDB.MARIADB_DATABASE}}"
DB_PASSWORD="${{MariaDB.MARIADB_PASSWORD}}"
...

jonnypaes
FREEOP

a month ago

Something like this:

{
"DBHOST": "${{MYSQLHOST}}", "DBNAME": "${{MYSQLDATABASE}}",
"DBPASS": "${{MYSQLPASSWORD}}", "DBPORT": "${{MYSQLPORT}}",
"DB_USER": "${{MYSQLUSER}}"
}

DBHOST: mysql.railway.internal - MYSQLHOST DBUSER: root - MYSQLUSER
DBPASS: KYfIFhfIkGtjS… - MYSQLPASSWORD DBNAME: railway - MYSQLDATABASE
DB_PORT: 3306 - MYSQLPORT


jonnypaes
FREEOP

a month ago

Tried both, the variables and the constants. The error is the same as in the picture.


a month ago

Make sure to include the service's name when referencing variables from another service. For example ${{MySQL.MYSQLHOST}}.


a month ago

There is also an indicator in the dashboard when you are actually referencing variables from another service.

1467226636167414000


jonnypaes
FREEOP

a month ago

What? How can I make this connection?


jonnypaes
FREEOP

a month ago

Great tip. Thank you. But I will try this later. Now I'm trying to add the constants, so I can make sure I'm not making anything wrong with the variables


a month ago

This connection is automatically shown when you have a service referencing a variable from another service.


jonnypaes
FREEOP

a month ago

The same =/

My variables:
DBHOST="${{MySQL.MYSQLHOST}}" DBNAME="${{MySQL.MYSQLDATABASE}}"
DBPASS="${{MySQL.MYSQLPASSWORD}}" DBPORT="${{MySQL.MYSQLPORT}}"
DB_USER="${{MySQL.MYSQLUSER}}"

1467228946000118000


a month ago

Hey, I just deployed your backend (root directory set to backend with the source being your public GitHub repository) and seems to work correctly with

DB_HOST="${{MySQL.MYSQLHOST}}"
DB_PORT="${{MySQL.MYSQLPORT}}"
DB_USER="${{MySQL.MYSQLUSER}}"
DB_NAME="${{MySQL.MYSQLDATABASE}}"
DB_PASS="${{MySQL.MYSQLPASSWORD}}"

Do you have any data in your MySQL database? If not, then you can try to deploy another one and move the reference variables to the newly deployed MySQL database.

1467232267624648700


jonnypaes
FREEOP

a month ago

Weird. I'll try to remove this one and create another one.

To answer your question, no, the database is empty


jonnypaes
FREEOP

a month ago

Just an update.

Tried to delete the database and create a new one, it didn't work.

Tried to delete the backend and create a new one, it worked.

I don't know why, because I made my settings exactly as the default one.

Thank you very much, @uxuz.


a month ago

Glad that you have solved the issue, I'll mark this thread as solved <:salute:1137099685417451530>


Status changed to Solved uxuz about 1 month ago


Loading...