Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL Railway crashing (Upgrade Issue: How to Pin Docker Image Version)

Tags:

mysql

railway

I'm currently using Railway's Hobby Plan and needed to increase my MySQL database size. After doing so, every restart or redeployment started failing with the error:

Invalid MySQL server upgrade: Cannot upgrade from 80300 to 90000. Upgrade to next major version is only...

I was able to solve this but didn't have much resource online for railway to help, so i thought it best to document here so others can find it later. (See My Solution in the Answer Section)

like image 667
Olamigoke Philip Avatar asked Oct 30 '25 15:10

Olamigoke Philip


2 Answers

The default Docker image for MySQL in Railway points to https://hub.docker.com/_/mysql. However, this is not version-specific, so redeploying your app might result in versions mismatch since you last deployed your application/ DB server. Thus to mitigate against this, you can specify your preferred tag.

In this case, my current version is 80300 (i.e., 8.03.00, which is equal to 8.3.0). If not specified, the Dockerfile will always point to the latest version.

To update your settings:

  • Go to DB settings.
  • Click on the source image and disconnect the default mysql.
  • Input MySQL with your specific tag, e.g., mysql:8.3.0
  • A deploy action button will appear. Click Deploy.

Screenshot of DB settings

You should be good to go.

like image 110
Olamigoke Philip Avatar answered Nov 01 '25 04:11

Olamigoke Philip


My case's the same yours.

Change MySQL's version of the yml file to 8.4.5:

image: mysql:8.4.5

Then, in terminal run the following commands:

# docker-compose stop
# docker-compose pull
# docker-compose create
# docker-compose start

Then, change MySQL's version of the yml file to latest again:

image: mysql:latest

And finally, run the following commands again:

# docker-compose stop
# docker-compose pull
# docker-compose create
# docker-compose start

That's gonna solve your issue. One's actually an upgrade matter. Then, first upgranding first to 8.4.5 before latest fully solved my issue. You can perfectly check it out in logs with the following command:

# docker logs containername
like image 43
Jorge Luiz Avatar answered Nov 01 '25 04:11

Jorge Luiz