<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Geoff's weblog]]></title><description><![CDATA[Random thoughts, possibly regarding infrastructure in higher education]]></description><link>https://gklee.uk</link><generator>RSS for Node</generator><lastBuildDate>Tue, 05 May 2026 02:28:38 GMT</lastBuildDate><atom:link href="https://gklee.uk/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Upgrading a Terraform-managed MySQL Flexible Server]]></title><description><![CDATA[Azure offers the option to in-place upgrade an instance of Azure Database for MySQL Flexible Server (its managed MySQL-as-a-Service offering) from major version 5 to 8. Pretty handy. My MySQL flexible server is managed by Terraform - I wonder if we c...]]></description><link>https://gklee.uk/upgrading-a-terraform-managed-mysql-flexible-server</link><guid isPermaLink="true">https://gklee.uk/upgrading-a-terraform-managed-mysql-flexible-server</guid><category><![CDATA[Terraform]]></category><category><![CDATA[Azure]]></category><category><![CDATA[Devops]]></category><category><![CDATA[MySQL]]></category><category><![CDATA[TIL]]></category><category><![CDATA[todayilearned]]></category><dc:creator><![CDATA[Geoff Lee]]></dc:creator><pubDate>Fri, 28 Feb 2025 17:04:39 GMT</pubDate><content:encoded><![CDATA[<p>Azure offers the option to <a target="_blank" href="https://learn.microsoft.com/en-us/azure/mysql/flexible-server/how-to-upgrade">in-place upgrade</a> an instance of Azure Database for MySQL Flexible Server (its managed MySQL-as-a-Service offering) from major version 5 to 8. Pretty handy. My MySQL flexible server is managed by <a target="_blank" href="https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/mysql_flexible_server">Terraform</a> - I wonder if we can just change the version number?</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1740761030117/40b91292-7591-4096-a378-0f3e33d6891e.png" alt class="image--center mx-auto" /></p>
<p>Ah.</p>
<p>Ok, what happens if I run the upgrade using the Azure portal (or CLI) and <em>then</em> change the version number in the Terraform config? Let’s find out.</p>
<p>Deploy the upgrade:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1740761186393/f1bec74e-43c6-4b87-af84-5347f37a97e7.png" alt class="image--center mx-auto" /></p>
<p>Then, update the Terraform configuration:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1740762075706/908a3986-db42-4363-984d-098b3edfb88e.png" alt class="image--center mx-auto" /></p>
<p>And the moment of truth - run <code>terraform plan</code>:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1740761248872/022ebafa-24e1-4d9e-a913-96738f65edb1.png" alt class="image--center mx-auto" /></p>
<p>We’re in business!</p>
<p>As a side note, this MySQL server was in almost completely stock configuration but still produced an error when validating the upgrade:</p>
<pre><code class="lang-plaintext">Find invalid server parameters, please correct before upgrade to new server version
Name: sql_mode, 
Current value: ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER, 
Allowed values: ,ALLOW_INVALID_DATES,ANSI_QUOTES,ERROR_FOR_DIVISION_BY_ZERO,HIGH_NOT_PRECEDENCE,IGNORE_SPACE,NO_AUTO_VALUE_ON_ZERO,NO_BACKSLASH_ESCAPES,NO_DIR_IN_CREATE,NO_ENGINE_SUBSTITUTION,NO_UNSIGNED_SUBTRACTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,ONLY_FULL_GROUP_BY,PAD_CHAR_TO_FULL_LENGTH,PIPES_AS_CONCAT,REAL_AS_FLOAT,STRICT_ALL_TABLES,STRICT_TRANS_TABLES,TIME_TRUNCATE_FRACTIONAL, 
Issueed values: NO_AUTO_CREATE_USER
</code></pre>
<p>Fixing this was a matter of changing the <code>sql_mode</code> setting in the ‘Server Parameters’ pane to remove <code>NO_AUTO_CREATE_USER</code> which has <a target="_blank" href="https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-11.html">been removed</a> since MySQL version 8.0.11.</p>
]]></content:encoded></item></channel></rss>