<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Mysql on Duke Hsu ｜ Learn • Build • Share</title><link>https://www.dukehsu.com/tags/mysql.html</link><description>Recent content in Mysql on Duke Hsu ｜ Learn • Build • Share</description><image><title>Duke Hsu ｜ Learn • Build • Share</title><url>https://www.dukehsu.com/images/og-default.jpg</url><link>https://www.dukehsu.com/images/og-default.jpg</link></image><generator>Hugo</generator><language>en-US</language><lastBuildDate>Sat, 10 Feb 2024 00:00:00 +0000</lastBuildDate><atom:link href="https://www.dukehsu.com/tags/mysql/index.xml" rel="self" type="application/rss+xml"/><item><title>MySQL ERROR 1045 (28000) Access denied for user 解决办法</title><link>https://www.dukehsu.com/posts/mysql1045error.html</link><pubDate>Sat, 10 Feb 2024 00:00:00 +0000</pubDate><guid>https://www.dukehsu.com/posts/mysql1045error.html</guid><description>&lt;p&gt;记得上次被MySQL教训还是在10年前，如今又一次被MySQL折腾一次。早9点开始到现在下午5点。总算是把MySQL装好在Windows10上了。&lt;/p&gt;
&lt;h3 id="mysql安装"&gt;MySQL安装&lt;/h3&gt;
&lt;p&gt;&lt;a href="https://dev.mysql.com/downloads/installer/"&gt;https://dev.mysql.com/downloads/installer/&lt;/a&gt;&lt;br&gt;
选择你要的版本安装即可&lt;/p&gt;
&lt;p&gt;一切安装完成之后，通过CMD登录或者Navicat 登录会提示&lt;br&gt;
&lt;code&gt;---date [ERROR] [MY-011084] [Server] Keyring migration failed.&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;---date [ERROR] [MY-010119] [Server] Aborting&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;于是跟着stackoverflow 开始操作&lt;br&gt;
&lt;a href="https://stackoverflow.com/questions/51448958/mysql-server-8-0-keyring-migration-error-at-login"&gt;https://stackoverflow.com/questions/51448958/mysql-server-8-0-keyring-migration-error-at-login&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;跟着Sabito的操作可以直接在cmd中登录，但是当启动WindowsService再来用cmd登录的时候会出现以下错误&lt;/p&gt;
&lt;p&gt;&lt;code&gt;ERROR 1045 (28000) Access denied for user root@localhost (using password: YES)&lt;/code&gt;&lt;/p&gt;
&lt;h3 id="解决办法"&gt;解决办法&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;停止MySQL服务&lt;/li&gt;
&lt;li&gt;新增一个文本文档命名为‘mysqlinit.txt’&lt;br&gt;
在文档中写入以下内容&lt;br&gt;
&lt;code&gt;ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password'&lt;/code&gt;&lt;br&gt;
将该文档拷贝到&lt;strong&gt;C:&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;CMD管理员权限进入MySQL Server 的 bin目录&lt;br&gt;
在cmd窗口输入以下命令 然后回车&lt;br&gt;
&lt;code&gt;--defaults-file=&amp;quot;C:\ProgramData\MySQL\MySQL Server 8.0\my.ini&amp;quot; --init-file=C:\\mysqlinit.txt --console&lt;/code&gt;&lt;br&gt;
等待命令执行完成，按Ctrl+C 退出CMD 并关闭&lt;/li&gt;
&lt;li&gt;重新启动MySQL服务&lt;br&gt;
这个时候就可以使用CMD或者Navicat 登录了&lt;br&gt;
&lt;img loading="lazy" src="https://www.dukehsu.com/posts/mysql1045error/images/1773920245.png"&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="参考"&gt;参考&lt;/h3&gt;
&lt;p&gt;How to Fix &amp;quot; access denied for user &amp;lsquo;root&amp;rsquo;@&amp;rsquo;localhost&amp;rsquo; (using password: yes) &amp;quot; in MySQL Window 10&lt;br&gt;
&lt;a href="https://www.youtube.com/watch?v=8l2NUwm-OIk"&gt;https://www.youtube.com/watch?v=8l2NUwm-OIk&lt;/a&gt;&lt;/p&gt;</description></item></channel></rss>