{"id":410,"date":"2011-01-31T06:04:53","date_gmt":"2011-01-31T12:04:53","guid":{"rendered":"http:\/\/blog.supportpro.com\/2011\/01\/resetting-mysql-admin-password-in-windows-server\/"},"modified":"2026-03-27T00:12:10","modified_gmt":"2026-03-27T06:12:10","slug":"resetting-mysql-admin-password-in-windows-server","status":"publish","type":"post","link":"https:\/\/www.supportpro.com\/blog\/resetting-mysql-admin-password-in-windows-server\/","title":{"rendered":"How to Reset MySQL Root Password on Windows Server"},"content":{"rendered":"\n<p>Losing or forgetting the MySQL administrator (root) password on a Windows server can disrupt database access and application functionality. This guide explains <strong data-start=\"498\" data-end=\"566\">how to safely reset the MySQL admin password on a Windows Server<\/strong> using the built-in initialization file method.<\/p>\n\n\n\n<p>This method is commonly used by <strong data-start=\"647\" data-end=\"713\">system administrators, hosting providers, and IT support teams<\/strong> managing Windows-based MySQL installations.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">When Do You Need to Reset the MySQL Admin Password?<\/h2>\n\n\n\n<p>You may need to reset the MySQL root password if:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><p data-start=\"872\" data-end=\"913\">The admin password is lost or forgotten<\/p><\/li>\n\n\n\n<li><p data-start=\"916\" data-end=\"959\">MySQL access is blocked after a migration<\/p><\/li>\n\n\n\n<li><p data-start=\"962\" data-end=\"1007\">Security policies require password rotation<\/p><\/li>\n\n\n\n<li><p data-start=\"1010\" data-end=\"1062\">You are restoring or taking over server management<\/p><\/li>\n<\/ul>\n\n\n\n<p>Ensuring secure database access is a core part of overall server security. You may also find these <strong data-start=\"1163\" data-end=\"1198\">website security best practices<\/strong> useful:<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Steps to Reset MySQL Admin Password in Windows Server<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Step 1: Stop the MySQL Service<\/h3>\n\n\n\n<p>Log in to the Windows system as <strong data-start=\"1463\" data-end=\"1480\">Administrator<\/strong>.<br data-start=\"1481\" data-end=\"1484\">If MySQL is running, stop the service using the Services Manager:<\/p>\n\n\n\n<p><strong data-start=\"1551\" data-end=\"1615\">Start Menu \u2192 Control Panel \u2192 Administrative Tools \u2192 Services<\/strong><br data-start=\"1615\" data-end=\"1618\">Locate the <strong data-start=\"1629\" data-end=\"1646\">MySQL service<\/strong> and click <strong data-start=\"1657\" data-end=\"1665\">Stop<\/strong>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 2: Create an Initialization File<\/h3>\n\n\n\n<p>Create a text file and add the following command on a <strong data-start=\"1769\" data-end=\"1784\">single line<\/strong>:<\/p>\n\n\n\n<div class=\"contain-inline-size rounded-2xl corner-superellipse\/1.1 relative bg-token-sidebar-surface-primary\">\n<div class=\"sticky top-[calc(--spacing(9)+var(--header-height))] @w-xl\/main:top-9\">\n<div class=\"absolute end-0 bottom-0 flex h-9 items-center pe-2\">\n<div class=\"bg-token-bg-elevated-secondary text-token-text-secondary flex items-center gap-4 rounded-sm px-2 font-sans text-xs\">&nbsp;<\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"whitespace-pre!\"><span class=\"hljs-keyword\">SET<\/span> <span class=\"hljs-keyword\">PASSWORD<\/span> <span class=\"hljs-keyword\">FOR<\/span> root@<span class=\"hljs-string\">'localhost'<\/span> = <span class=\"hljs-keyword\">PASSWORD<\/span>(<span class=\"hljs-string\">'NewPassword'<\/span>);<br>\n<\/code><\/div>\n<\/div>\n\n\n\n<p>Save the file in a secure location. For example:<\/p>\n\n\n\n<div class=\"contain-inline-size rounded-2xl corner-superellipse\/1.1 relative bg-token-sidebar-surface-primary\">\n<div class=\"sticky top-[calc(--spacing(9)+var(--header-height))] @w-xl\/main:top-9\">\n<div class=\"absolute end-0 bottom-0 flex h-9 items-center pe-2\">\n<div class=\"bg-token-bg-elevated-secondary text-token-text-secondary flex items-center gap-4 rounded-sm px-2 font-sans text-xs\">&nbsp;<\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"whitespace-pre!\"><span class=\"hljs-section\">C:\\mysql-pass.txt<\/span><br>\n<\/code><\/div>\n<\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Step 3: Open Command Prompt<\/h3>\n\n\n\n<p>Open the DOS command prompt:<\/p>\n\n\n\n<p><strong data-start=\"2000\" data-end=\"2026\">Start Menu \u2192 Run \u2192 cmd<\/strong><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 4: Start MySQL with the Init File<\/h3>\n\n\n\n<p>If MySQL is installed in <code data-start=\"2101\" data-end=\"2111\">C:\\mysql<\/code>, run the following command:<\/p>\n\n\n\n<div class=\"contain-inline-size rounded-2xl corner-superellipse\/1.1 relative bg-token-sidebar-surface-primary\">\n<div class=\"sticky top-[calc(--spacing(9)+var(--header-height))] @w-xl\/main:top-9\">\n<div class=\"absolute end-0 bottom-0 flex h-9 items-center pe-2\">\n<div class=\"bg-token-bg-elevated-secondary text-token-text-secondary flex items-center gap-4 rounded-sm px-2 font-sans text-xs\">&nbsp;<\/div>\n<\/div>\n<\/div>\n<div class=\"overflow-y-auto p-4\" dir=\"ltr\"><code class=\"whitespace-pre!\"><span class=\"hljs-built_in\">C<\/span><span class=\"hljs-operator\">:<\/span>\\<span class=\"hljs-operator\">&gt;<\/span> <span class=\"hljs-built_in\">C<\/span><span class=\"hljs-operator\">:<\/span>\\<span class=\"hljs-variable\">mysql<\/span>\\<span class=\"hljs-variable\">bin<\/span>\\<span class=\"hljs-variable\">mysqld<\/span><span class=\"hljs-operator\">-<\/span><span class=\"hljs-variable\">nt<\/span> <span class=\"hljs-operator\">--<\/span><span class=\"hljs-variable\">init<\/span><span class=\"hljs-operator\">-<\/span><span class=\"hljs-variable\">file<\/span><span class=\"hljs-operator\">=<\/span><span class=\"hljs-built_in\">C<\/span><span class=\"hljs-operator\">:<\/span>\\<span class=\"hljs-variable\">mysql<\/span><span class=\"hljs-operator\">-<\/span><span class=\"hljs-variable\">pass<\/span><span class=\"hljs-operator\">.<\/span><span class=\"hljs-variable\">txt<\/span><br>\n<\/code><\/div>\n<\/div>\n\n\n\n<p>If MySQL is installed in a different directory, modify the path accordingly.<\/p>\n\n\n\n<p>This command starts MySQL and executes the password reset instruction during startup.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 5: Allow MySQL to Update the PasswordOnce the server starts successfully, the contents of the initialization file are executed, updating the MySQL root password automatically.<\/h3>\n\n\n\n<h3 class=\"wp-block-heading\">Step 6: Restart MySQL Normally<\/h3>\n\n\n\n<p>Stop the MySQL server and restart it in normal mode.<\/p>\n\n\n\n<p>If MySQL runs as a Windows service, start it again from the <strong data-start=\"2719\" data-end=\"2731\">Services<\/strong> window.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 7: Log In Using the New Password<\/h3>\n\n\n\n<p>You can now connect to the MySQL server using the newly set admin password.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Security and Best Practices<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><p data-start=\"2904\" data-end=\"2962\">Always remove the init file after resetting the password<\/p><\/li>\n\n\n\n<li><p data-start=\"2965\" data-end=\"2996\">Use a strong, unique password<\/p><\/li>\n\n\n\n<li><p data-start=\"2999\" data-end=\"3044\">Restrict admin access to trusted users only<\/p><\/li>\n\n\n\n<li><p data-start=\"3047\" data-end=\"3095\">Regularly audit server security configurations<\/p><\/li>\n<\/ul>\n\n\n\n<p>For deeper insights into infrastructure security, you may also read:<br><a class=\"decorated-link\" data-start=\"3171\" data-end=\"3256\" href=\"https:\/\/www.supportpro.com\/blog\/securing-dns\/\" target=\"_new\" rel=\"noopener\">Securing DNS Servers: Best Practices<\/a> <a class=\"decorated-link\" data-start=\"3262\" data-end=\"3411\" href=\"https:\/\/www.supportpro.com\/blog\/debian-vs-centos-a-comparison-based-on-webhosting-needs\/\" target=\"_new\" rel=\"noopener\">Debian vs CentOS: A Comparison Based on Web Hosting Needs<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why Expert Server Support Matters<\/h2>\n\n\n\n<p>Password recovery is often just one part of broader server management challenges. A reliable support team ensures uptime, security, and compliance across your infrastructure.<\/p>\n\n\n\n<p>Learn more here:<br><a class=\"decorated-link\" data-start=\"3654\" data-end=\"3807\" href=\"https:\/\/www.supportpro.com\/blog\/why-every-business-needs-a-reliable-dedicated-support-team\/\" target=\"_new\" rel=\"noopener\">Why Every Business Needs a Reliable Dedicated Support Team<\/a> <a class=\"decorated-link\" data-start=\"3813\" data-end=\"4027\" href=\"https:\/\/www.supportpro.com\/blog\/5-common-cloud-management-challenges-and-how-to-overcome\/common-cloud-management-challenges-and-how-to-overcome-them\/\" target=\"_new\" rel=\"noopener\">5 Common Cloud Management Challenges and How to Overcome Them<\/a> <a class=\"decorated-link\" data-start=\"4033\" data-end=\"4149\" href=\"https:\/\/www.supportpro.com\/blog\/what-are-the-benefits-of-deployment-automation\/\" target=\"_new\" rel=\"noopener\">Benefits of Deployment Automation<\/a><\/p>\n\n\n\n<p>If you require professional assistance with <strong data-start=\"4200\" data-end=\"4274\">MySQL administration, Windows server management, or security hardening<\/strong>, contact <a href=\"https:\/\/www.supportpro.com\/requestquote.php\"><strong data-start=\"4284\" data-end=\"4311\">SupportPRO Server Admin<\/strong><\/a> for expert support.<\/p>\n\n\n\n<p class=\"has-text-align-center\"><span id=\"hs-cta-wrapper-9d590242-d641-4383-94b4-8cfd62f0af6b\" class=\"hs-cta-wrapper\"><span id=\"hs-cta-9d590242-d641-4383-94b4-8cfd62f0af6b\" class=\"hs-cta-node hs-cta-9d590242-d641-4383-94b4-8cfd62f0af6b\"><a href=\"https:\/\/cta-redirect.hubspot.com\/cta\/redirect\/2725694\/9d590242-d641-4383-94b4-8cfd62f0af6b\"><\/a><\/span><\/span><\/p>\n\n\n\n<div class=\"wp-block-media-text alignwide has-media-on-the-right is-stacked-on-mobile is-vertically-aligned-center has-white-background-color has-background\"><div class=\"wp-block-media-text__content\">\n<p class=\"has-large-font-size\">Facing issues? <\/p>\n\n\n\n<p class=\"has-large-font-size\">Our technical support<br>engineers can solve it. <\/p>\n\n\n\n<!--HubSpot Call-to-Action Code --><span class=\"hs-cta-wrapper\" id=\"hs-cta-wrapper-3350a795-db50-482f-9911-301930d1b1be\"><span class=\"hs-cta-node hs-cta-3350a795-db50-482f-9911-301930d1b1be\" id=\"hs-cta-3350a795-db50-482f-9911-301930d1b1be\"><!--[if lte IE 8]><div id=\"hs-cta-ie-element\"><\/div><![endif]--><a href=\"https:\/\/cta-redirect.hubspot.com\/cta\/redirect\/2725694\/3350a795-db50-482f-9911-301930d1b1be\" ><img decoding=\"async\" class=\"hs-cta-img\" id=\"hs-cta-img-3350a795-db50-482f-9911-301930d1b1be\" style=\"border-width:0px;\" src=\"https:\/\/no-cache.hubspot.com\/cta\/default\/2725694\/3350a795-db50-482f-9911-301930d1b1be.png\"  alt=\"Contact Us today!\"\/><\/a><\/span><script charset=\"utf-8\" src=\"https:\/\/js.hscta.net\/cta\/current.js\"><\/script><script type=\"text\/javascript\"> hbspt.cta.load(2725694, '3350a795-db50-482f-9911-301930d1b1be', {\"useNewLoader\":\"true\",\"region\":\"na1\"}); <\/script><\/span><!-- end HubSpot Call-to-Action Code -->\n<\/div><figure class=\"wp-block-media-text__media\"><img fetchpriority=\"high\" decoding=\"async\" width=\"904\" height=\"931\" src=\"https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/09\/Free-server-checkup.png\" alt=\"guy server checkup\" class=\"wp-image-12943 size-full\" srcset=\"https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/09\/Free-server-checkup.png 904w, https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/09\/Free-server-checkup-291x300.png 291w, https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/09\/Free-server-checkup-768x791.png 768w, https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/09\/Free-server-checkup-585x602.png 585w\" sizes=\"(max-width: 904px) 100vw, 904px\" \/><\/figure><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Losing or forgetting the MySQL administrator (root) password on a Windows server can disrupt database access and application functionality. This guide explains how to safely reset the MySQL admin password&hellip;<\/p>\n","protected":false},"author":4,"featured_media":15157,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_lmt_disableupdate":"","_lmt_disable":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-410","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-miscellaneous"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/410","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/comments?post=410"}],"version-history":[{"count":7,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/410\/revisions"}],"predecessor-version":[{"id":16749,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/410\/revisions\/16749"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/media\/15157"}],"wp:attachment":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/media?parent=410"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/categories?post=410"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/tags?post=410"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}