Unable to setup MySQL 5.7
ahsen2928
HOBBYOP

6 months ago

I am trying to change the image of out of the box MySQL service but it is not allowing to downgrade from major version.
When i am using custom service and providing mysql:5.7.44 docker image then it pulls the image and says to setup variables. Even after setting up variable or not, i am not able to connect it using internal host in one of my another java based service.

Can you guide as i am new to railway and chosen it for a deployment but mysql is causing trouble since 2 days.

I have seen some other thread related to same but in every thread there is no solution or guide proper, but the railway developer/focal person settle it directly by accessing the customer's project.
So it would be appreciated if you can help me in the same way or it would be more better if you can share the details process. Anyone will be appreciated.

Thanks

Solved$10 Bounty

6 Replies

Railway
BOT

6 months ago

Hey there! We've found the following might help you get unblocked faster:

If you find the answer from one of these, please let us know by solving the thread!


christian
EMPLOYEE

6 months ago

As you point out, you need to set the environment variables for the service to function.

The fastest and easiest way to get started is by deploying MySQL from a template. See, for example, the MySQL template: https://railway.com/deploy/mysql


Status changed to Awaiting User Response Railway 6 months ago


ahsen2928
HOBBYOP

6 months ago

Thanks @christian for the response.

When i do that using template the steps are. I added a service 'Database' -> 'MySQL'. Set the image to '5.7.44' and wipe the volume if trying for 2nd time onward and Deploy it. It throws this error.

Volume is for sure empty as i wipe it but as i cannot access the directory thats why couldn't 100% confirm. Template it causing this issue. Can you guide here?

Attachments


ahsen2928
HOBBYOP

6 months ago

Thanks @franceskora for the detail steps.

I agree and I am clear on this that I need to setup custom service to get the older MySQL DB version but it's still throwing errors differently on each step. Let me share each error in detail.

==> When i follow your steps 1 to 3. I am done with running mysql but it is showing that variables are missing. As you mentioned to add only 2 variables so i added those 2 mentioned in Step#3. But the error in Data tab is as mentioned in the image below:

==> How to proceed from here? Do i need to add these variables? If YES then If i try to add user and password that it says a Warning that:

Warning: MySQL authentication changes

This will manually change both the username and password variables without updating the actual database credentials.

What will happen:

warning emojiDatabase will still use the old credentials internally

warning emojiApplications may try to connect with the new credentials and fail

Due to this, even if i setup some username password, I am not able to connect with it from other railway service.

Additionally I am facing issue on Step#4 that even if i wipe the volume multiple times and even change the volume mount path, it keeps on saying this error


I hope errors are clear to you know.
Appreciated your support


ahsen2928
HOBBYOP

6 months ago

Thanks @franceskora for the detailed steps.
I have tried to follow. With slight changes like i used mount path as "var/lib/mysql1" instead of '/var/lib/mysql" because even after wiping it was throwing same errors with volume.
Anyhow mysql seems running fine now with these logs.

As you mentioned, I have only setup 2 variables as mentioned in the screenshot below:

Now, when i am referencing it inside my backend java service like below:

It is not connecting and throwing error of communication link failure.



In my java spring boot project application-prod.properties file i have tried 2 ways. 1st is the comment lines 1 to 6. Secondly via Line 8,9,10. But still same connection failure error. Any clue?


ahsen2928
HOBBYOP

6 months ago

Thanks @francekora for the help this far. Appreciated.

Just wanted to share the final steps so that if anyone gets stuck here can see this summarized message to sort it out.

  • I was trying to setup mysql:5.7.44 on railway custom service. I did this by creating a new service, set the image to mysql:5.7.44

  • After that I added some environment variables as mentioned in the screenshot below:

  • Set the values of each. (Note: User should be other than root)

  • Turn on the service by deploying it. Once done then create a Volume and set its mount path to default /var/lib/mysql. And deploy the changes. It should setup Mysql.
    (Note: If it throws error of directory already contains data then try to wipe the volume first and re-deploy. If it still doesn't work then try to change the mount path like this one /var/lib/mysql1 worked for me. Also ignore any warning coming in during this process.)

  • Once done, use these variables like these in your other service. The right way to reference a variable in other service is mentioned below:

  • Here in mysql.MYSQL_USER mysql is the name of your MYSQL service and MYSQL_USER is the variable of that service exporting.

  • And it will make things work fine.

    Thanks.


Status changed to Solved brody 6 months ago


Loading...