1

I have upgraded one of our sites to Craft CMS 4 and moved it to a staging site on Azure. The front-end works but the control panel gives the MySQL 5.7.8 or higher is required to run Craft CMS error.

enter image description here

It looks like the wrong MySQL version is being returned by PDO::ATTR_SERVER_VERSION.

$conn->getAttribute(PDO::ATTR_SERVER_VERSION) returns: 5.6.47.0

$conn->query('select version()')->fetchColumn() returns: 5.7.32.log

MySQL Workbench also returns 5.7.32

Anybody else encountered this problem or have any suggested workarounds?

Thanks!

6
  • The only workaround that I have found so far is to manually change $requiredMySqlVersion in \vendor\craft\server-check\server\RequirementsChecker.php
    – Watsonian
    Commented Mar 23, 2023 at 19:02
  • Hi there, this looks like an issue in your hosting environment. Changing the required version in craft vendor folder is not recommended. I would pursue Azure hosting assistance for why your environment's MySQL version is coming up as the wrong one.
    – cherrykoda
    Commented Mar 23, 2023 at 19:14
  • @cherrykoda Yeah, it certainly wasn't ideal. I found a solution. By changing the DB_PORT environment variable to 3308. It now reports the MySQL version as 5.7.29.0 Still doesn't match what select version() reports, but it removes the error. learn.microsoft.com/en-us/azure/mysql/single-server/… Thanks!
    – Watsonian
    Commented Mar 23, 2023 at 21:23
  • @Watsonian Glad you got it sorted! Would you mind adding what you found as an official answer in case it helps someone in the future?
    – Brad Bell
    Commented Mar 24, 2023 at 4:23
  • @BradBell Oh, yes! Added now. Thanks!
    – Watsonian
    Commented Mar 24, 2023 at 14:30

1 Answer 1

2

The solution to this problem was to change DB_PORT to 3308 rather than 3306. This then returns a MySQL version of 5.7.29.0. While it still doesn't match the actual server version, it removes the error in the control panel.

Full details can be found here: https://learn.microsoft.com/en-us/azure/mysql/single-server/concepts-connect-to-a-gateway-node

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.