{"id":248,"date":"2023-12-29T13:21:57","date_gmt":"2023-12-29T13:21:57","guid":{"rendered":"https:\/\/iain.rauch.co.uk\/blog\/?p=248"},"modified":"2023-12-29T13:21:57","modified_gmt":"2023-12-29T13:21:57","slug":"mysql-how-to-solve-my-013360-mysql_native_password-is-deprecated","status":"publish","type":"post","link":"https:\/\/iain.rauch.co.uk\/blog\/2023-12\/mysql-how-to-solve-my-013360-mysql_native_password-is-deprecated\/","title":{"rendered":"MySQL: How to solve &#8220;[MY-013360] mysql_native_password is deprecated&#8221;"},"content":{"rendered":"\n<p>Have you ever looked through your server logs and seen something like this?<\/p>\n<blockquote>\n<p>[MY-013360] [Server] Plugin mysql_native_password reported: &#8221;mysql_native_password&#8217; is deprecated and will be removed in a future release. Please use caching_sha2_password instead&#8217;<\/p>\n<\/blockquote>\n<p>This is because, as you can see in the <a href=\"https:\/\/dev.mysql.com\/doc\/relnotes\/mysql\/8.1\/en\/news-8-1-0.html#mysqld-8-1-0-deprecation-removal\" target=\"_blank\" rel=\"noopener\">MySQL 8.1.0 release notes<\/a>, the plugin is now deprecated.<\/p>\n<p>Luckily, the warning also tells you the solution &#8211; switch to <code>caching_sha2_password<\/code> instead. However it doesn&#8217;t tell you <em>how<\/em> to do that.<\/p>\n<p>This needs to be done on a per-user basis, and you also need to know the password of the user. To find out which users to update, run the following SQL:<\/p>\n<pre>SELECT user, host, plugin FROM mysql.user;<\/pre>\n<p><em>(Note, you can enter a SQL console on the host machine with something like <code>mysql -u root -p<\/code>)<\/em><\/p>\n<p>This will give you an output something like this:<\/p>\n<pre>mysql&gt; SELECT user, host, plugin FROM mysql.user ORDER BY user;\n+------------------+--------------+-----------------------+\n| user             | host         | plugin                |\n+------------------+--------------+-----------------------+\n| debian-sys-maint | localhost    | mysql_native_password |\n| example_user     | localhost    | mysql_native_password |\n| mysql.infoschema | localhost    | caching_sha2_password |\n| mysql.session    | localhost    | mysql_native_password |\n| mysql.sys        | localhost    | caching_sha2_password |\n| mysqld_exporter  | localhost    | mysql_native_password |\n| root             | localhost    | mysql_native_password |\n+------------------+--------------+-----------------------+<\/pre>\n<p>As you can see, some users are configured with the <code>mysql_native_password<\/code> plugin. All we need to do is <a href=\"https:\/\/dev.mysql.com\/doc\/refman\/8.0\/en\/alter-user.html\" target=\"_blank\" rel=\"noopener\">alter the users<\/a> and update them to <code>caching_sha2_password<\/code>.<\/p>\n<p>Here&#8217;s an example:<\/p>\n<pre>ALTER USER 'mysqld_exporter'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'StrongPassword';<\/pre>\n<p>You might want to <code>FLUSH PRIVILEGES;<\/code> once you&#8217;re done.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Have you ever looked through your server logs and seen something like this? [MY-013360] [Server] Plugin mysql_native_password reported: &#8221;mysql_native_password&#8217; is deprecated and will be removed in a future release. Please use caching_sha2_password instead&#8217; This is because, as you can see &hellip; <a href=\"https:\/\/iain.rauch.co.uk\/blog\/2023-12\/mysql-how-to-solve-my-013360-mysql_native_password-is-deprecated\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[8,5],"tags":[27],"class_list":["post-248","post","type-post","status-publish","format-standard","hentry","category-development","category-linux","tag-mysql"],"_links":{"self":[{"href":"https:\/\/iain.rauch.co.uk\/blog\/wp-json\/wp\/v2\/posts\/248","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/iain.rauch.co.uk\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/iain.rauch.co.uk\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/iain.rauch.co.uk\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/iain.rauch.co.uk\/blog\/wp-json\/wp\/v2\/comments?post=248"}],"version-history":[{"count":1,"href":"https:\/\/iain.rauch.co.uk\/blog\/wp-json\/wp\/v2\/posts\/248\/revisions"}],"predecessor-version":[{"id":249,"href":"https:\/\/iain.rauch.co.uk\/blog\/wp-json\/wp\/v2\/posts\/248\/revisions\/249"}],"wp:attachment":[{"href":"https:\/\/iain.rauch.co.uk\/blog\/wp-json\/wp\/v2\/media?parent=248"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/iain.rauch.co.uk\/blog\/wp-json\/wp\/v2\/categories?post=248"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/iain.rauch.co.uk\/blog\/wp-json\/wp\/v2\/tags?post=248"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}