|
Mysql错误:Error Nr.1045
问题提示:
Error Nr. 1045
Access denied for user 'root'@'localhost' (Using password: NO)
If a personal firewall is running on your machine, please make sure you have opened the TCP port 3306 for connections. Otherwise no client application can connect to the server. After you have opened the port please press [Retry] to apply the security settings.
If you are re-installing after you just uninstalled the MySQL server please note that the data directory was not removed automatically. Therefore the old password from your last installations is still needed to connect to the server. In this case please select skin now and re-run the Configuration Wizard from the start menu.
问题解决方案:
1再次使用MySQL Installer,什么都不用动,只需要点next, next, next, yes, yes, yes.这样就可以安装,启动Mysql了。
2使用Windows防火墙打开端口。开始-〉控制面板->windows防火墙-〉例外。
3点击“添加端口”按钮:名称:mysql 端口号:3306
4点击“添加程序”按钮:添加Mysql(C:/Programs Files/mysql 5.x.x/bin/mysql.exe )
5如果你愿意,那么重起你的电脑(我就这么做了,以防万一)
6下在Mysql管理员程序:http://dev.mysql.com或者http://mysql.he.net
7解压缩之后,在解压缩目录中双击MySQL Administrator.exe,启动 "MySQLAdministrator.exe"
Server host: localhost
Username: root
Password: whatever
点击OK
8点击左侧的“Startup Variables”。选中“Disable grant tables”。
9点击左侧的“Service Control”,然后选中“Start/Stop Service”标签。
10点击“Stop Service”--如果服务已经停止了,那么点击这个按钮可以启动服务。
如果你在系统中安装了php,那么我建议你使用phpMyAdmin来维护MySQL。
_______________________________________________________________
重装系统后,再安装Mysql,到最后一步Apply security settings,又遇到1045问题了。
错误代码 1045
Access denied for user 'root'@'localhost' (using password:YES)
google了下,原来是{$MYSQL_HOME}\data下的数据库文件问题,data下保存着之前root的登陆用户信息等。我的办法是:删掉{$MYSQL_HOME}\data下的所有文件,然后安装。ok...
这样做是不是太残忍了?
又google了下:
解决办法是重新设置root用户密码,在Windows平台下操作步骤如下:
1、以系统管理员身份登录到系统;
2、如果MySQL服务器正在运行,停止它。
如果是作为Windows服务运行的服务器,进入服务管理器:开始菜单->控制面板->管理工具->服务
如果服务器不是作为服务而运行的,可能需要使用任务管理器来强制停止它。
3、创建1个文本文件,并将下述命令置于单一行中:
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('MyNewPassword');
用任意名称保存该文件。在本例中,该文件为C:\mysql-init.txt。
4、进入DOS命令提示:开始菜单->运行-> cmd
假定你已将MySQL安装到C:\mysql。如果你将MySQL安装到了另一位置,请对下述命令进行相应的调整。
在DOS命令提示符下,执行命令:
C:\> C:\mysql\bin\mysqld-nt --init-file=C:\mysql-init.txt
在服务器启动时,执行由“--init-file”选项(作用:在启动时从指定的文件中读取SQL命令)命名的文件的内容,更改根用户密码。当服务器成功启动后,应删除C:\mysql-init.txt。
5、停止MySQL服务器,然后在正常模式下重启它。如果以服务方式运行服务器,应从Windows服务窗口启动它。如果以手动方式启动了服务器,能够像正常情形下一样使用命令。
应能使用新密码进行连接。
|
|