Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-03-24T14:28:54.707Z
Answers.LastActivityDate: 2023-03-24T14:28:54.707Z
Answers.UserDisplayName: Watsonian
Body: <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>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-03-23T19:02:56.447Z
Comments.Text: The only workaround that I have found so far is to manually change $requiredMySqlVersion in \vendor\craft\server-check\server\RequirementsChecker.php
Comments.UserDisplayName: Watsonian
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-03-23T19:14:04.667Z
Comments.Text: 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.
Comments.UserDisplayName: cherrykoda
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-03-23T21:23:35.050Z
Comments.Text: @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!
Comments.UserDisplayName: Watsonian
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-03-24T04:23:02.263Z
Comments.Text: @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?
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-03-24T14:30:49.560Z
Comments.Text: @BradBell Oh, yes! Added now. Thanks!
Comments.UserDisplayName: Watsonian
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-03-25T00:19:25.807Z
Comments.Text: @Watsonian thank you!
Comments.UserDisplayName: Brad Bell
Tags: <mysql>
Title: Azure returning incorrect MySQL version. MySQL 5.7.8 or higher is required to run Craft CMS
ThreadText: # 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**: @username_2 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>
  
  
  ---
  
  