MySQL命令行无法打开?

时间:2010-12-22 10:52:01

标签: mysql mysql-error-1045

我刚刚安装了最新版本的MySQL。直到现在我在Windows XP上使用它,但我想在另一台装有Windows 7的计算机上安装它。

即使正确配置了所有内容,MySQL客户端也不会显示在“开始”文件夹中。所以我去了MySQL的bin文件夹并尝试打开mysql.exe,但它会立即关闭。

然后我尝试在cmd&中打开mysql.exe。这就是我得到的

C:\Program Files\MySQL\MySQL Server 5.5\bin>mysql
ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: N O)

任何想法我怎么能让它工作?

4 个答案:

答案 0 :(得分:13)

提供用户名(root) C:\Program Files\MySQL\MySQL Server 5.5\bin>mysql -uroot

默认密码为空,但如果您设置,则还需要提供密码

答案 1 :(得分:7)

我不记得我第一次看到它的地方,但是在遇到这个问题之前,我发现我必须手动打开服务:

  1. Windows键+ R并键入Run并点击“enter”
  2. 输入“services.msc”,点击“确定”
  3. 找到“MySQL56”,右键单击并选择“开始”
  4. 您现在应该可以毫无困难地登录
  5. 这是对我有用的解决方案;希望它可以帮助其他人。

答案 2 :(得分:0)

@Herschel所说的是正确的,如果你按照他的步骤1-4然后尝试使用你的密码在命令行登录你就没有问题。

您还可以将其作为服务自动运行,这是在服务器上运行时所需要的。

  1. Open Run
  2. 键入“services.msc”,然后单击“确定”
  3. 查找MySQL服务
  4. 右键单击属性,然后转到启动类型:
  5. 将其更改为自动

答案 3 :(得分:0)

我按照以下步骤操作,对我有用:

1. Open Command prompt in admin and go to the location of Mysql bin folder and type -  
    C:\ProgramFile\mysql\bin>mysql -u root -p <password>
2. Then the prompt asks for the password. This is the password or the root user which 
    you had set during installation of mysql. 
3. Type the password and you will login in to mysql. 
4. Also make sure your mysql service is running in the backend by going to the 
   windows service panel and check whether the mysql service is running. 
相关问题