<p>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.</p>
<p>Full details can be found here:
<a href="https://learn.microsoft.com/en-us/azure/mysql/single-server/concepts-connect-to-a-gateway-node" rel="nofollow noreferrer">https://learn.microsoft.com/en-us/azure/mysql/single-server/concepts-connect-to-a-gateway-node</a></p>

CC BY-SA 4.0
2023-03-24T14:28:54.707Z
2023-03-24T14:28:54.707Z
Watsonian
<p>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.</p>
<p><a href="https://i.sstatic.net/LJ2Xd.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/LJ2Xd.png" alt="enter image description here" /></a></p>
<p>It looks like the wrong MySQL version is being returned by <code>PDO::ATTR_SERVER_VERSION</code>.</p>
<p><code>$conn-&gt;getAttribute(PDO::ATTR_SERVER_VERSION)</code> returns: 5.6.47.0</p>
<p><code>$conn-&gt;query('select version()')-&gt;fetchColumn()</code> returns: 5.7.32.log</p>
<p>MySQL Workbench also returns 5.7.32</p>
<p>Anybody else encountered this problem or have any suggested workarounds?</p>
<p>Thanks!</p>

CC BY-SA 4.0
2023-03-23T19:02:56.447Z
The only workaround that I have found so far is to manually change $requiredMySqlVersion in \vendor\craft\server-check\server\RequirementsChecker.php
Watsonian
CC BY-SA 4.0
2023-03-23T19:14:04.667Z
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
CC BY-SA 4.0
2023-03-23T21:23:35.050Z
@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.

https://learn.microsoft.com/en-us/azure/mysql/single-server/concepts-connect-to-a-gateway-node

Thanks!
Watsonian
CC BY-SA 4.0
2023-03-24T04:23:02.263Z
@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
CC BY-SA 4.0
2023-03-24T14:30:49.560Z
@BradBell Oh, yes! Added now. Thanks!
Watsonian
CC BY-SA 4.0
2023-03-25T00:19:25.807Z
@Watsonian thank you!
Brad Bell
<mysql>
Azure returning incorrect MySQL version. MySQL 5.7.8 or higher is required to run Craft CMS
# Azure returning incorrect MySQL version. MySQL 5.7.8 or higher is required to run Craft CMS

(Asked by: username_0 on 2023-03-23)

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](https://i.sstatic.net/LJ2Xd.png)](https://i.sstatic.net/LJ2Xd.png)

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!

**Tags:** mysql

> **Comments:**
> **username_0**: The only workaround that I have found so far is to manually change $requiredMySqlVersion in \vendor\craft\server-check\server\RequirementsChecker.php  
> **username_1**: 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.  
> **username_0**: @username_1 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.  https://learn.microsoft.com/en-us/azure/mysql/single-server/concepts-connect-to-a-gateway-node  Thanks!  
> **username_2**: @username_0 Glad you got it sorted! Would you mind adding what you found as an official answer in case it helps someone in the future?  
> **username_0**: @BradBell Oh, yes! Added now. Thanks!  
> **username_2**: @username_0 thank you!  

---

## 1 answers

### Answer by username_0 on 2023-03-24. Score: 2 | Accepted answer

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>


---

