卸载原先64位Mysql
1.查找mysql:sc query mysql

2.删除sql服务:sc delete mysql

新建ini文件

进入bin目录运行命令:mysqld --initialize

出现上述问题时,新建一个data目录,然后在配置文件中添加数据文件路径配置;

再次运行无错;
安装服务:mysqld install

启动:net start mysql

修改密码
1.多数方法是在my.ini文件的[mysqld]中添加了skip-grant-tables;但是添加之后,多次进行登录让要求密码,重启mysql多次亦无效,因此使用如下的办法了
2.管理员模式打开cmd,输入命令:
mysqld --defaults-file="路径\my.ini" --skip-grant-tables
如下:

3.开启另一个cmd,进行登录后,修改密码,命令为:
-update mysql.user set authentication_string=PASSWORD("root") where User="root";
-FLUSH PRIVILEGES;
过程如下:

登录:进入原先运行【mysqld --defaults-file="路径\my.ini" --skip-grant-tables】的cmd窗口,Crtl+c结束,重启mysql服务后,即可登录,过程如下:

网友评论