MySQL 命令行打不开?

发布于 2024-10-09 01:56:37 字数 360 浏览 11 评论 0原文

我刚刚安装了最新版本的 MySQL。到目前为止,我在 Windows XP 上安装了它,但我想将其安装在另一台装有 Windows 7 的计算机上。

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

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

C:\Program Files\MySQL\MySQL Server 5.5\bin>mysql
错误 1045 (28000):用户“ODBC”@“localhost”的访问被拒绝(使用密码:N O)

有什么想法可以让它发挥作用吗?

I just installed the latest version of MySQL. Until Now I had it on Windows XP but I wanted to install this on another computer with Windows 7.

Even after configuring everything correctly, the MySQL client won't show up in the Start Folder. So I went to the bin folder of MySQL and tried opening mysql.exe but it would immediately close down.

I then tried opening mysql.exe in cmd & this is what I get

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

Any Ideas how I can get this to work?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

微凉 2024-10-16 01:56:37

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

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

Provide username (root)
C:\Program Files\MySQL\MySQL Server 5.5\bin>mysql -uroot

Default passsword is blank, but if you set it, you will need to provde password as well

花之痕靓丽 2024-10-16 01:56:37

我不记得我第一次读到它是在哪里,但是之前遇到这个问题时,我发现我必须手动打开一个服务:

  1. Windows键+R并输入“运行”并按“回车”
  2. 输入“services.msc”,按“确定”
  3. 找到“MySQL56”,右键单击并选择“开始”
  4. 您现在应该能够毫无问题地登录

这就是对我有用的解决方案;希望它能帮助其他人。

I don't recall where I first read it, but when facing this problem before, I found that I had to manually turn on a service:

  1. Windows key+R and type Run and hit "enter"
  2. Type "services.msc", hit "OK"
  3. Find "MySQL56", right-click and choose "Start"
  4. You should now be able to log in with no trouble

That's the solution that worked for me; hopefully it helps others out there.

仅此而已 2024-10-16 01:56:37

@Herschel 所说的是正确的,如果您按照他的步骤 1-4 然后尝试在命令行中使用密码登录,您将不会遇到任何问题。

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

  1. 打开运行
  2. 类型“services.msc”单击确定
  3. 找到MySQL服务
  4. 右键单击属性然后进入启动类型:
  5. 将其更改为自动

What @Herschel said is right if you follow his steps 1-4 then try to log in with your password in command line you'll have no trouble.

You can also make this run automatically as a service, something which you need when running it on a server.

  1. Open Run
  2. Type "services.msc" click ok
  3. Find the MySQL service
  4. Right-click properties then go down to startup type:
  5. Change it to automatic
很快妥协 2024-10-16 01:56:37

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

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. 

I followed these steps and it worked for me:

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. 
晨曦÷微暖 2024-10-16 01:56:37

嘿嘿嘿嘿。因此,截至 2022 年 3 月 19 日,我遇到了同样的问题,但我会向您展示我是如何解决它的。开始之前我的规格:

  • MySql 版本:8.0
  • 操作系统:Windows 10
  • 操作系统内部版本:19044.1586

好吧,我对 SQL 相当陌生,正在按照教程进行操作,但是当它到达打开客户端命令行的时候,它就不会了没有打开,它只是弹出并关闭;甚至没有要求密码。在观看了几个教程(非常没有帮助)之后,我从这些教程中注意到他们提供的解决方案是“激活 MYSQL80 服务”,但这对我没有帮助,因为我在服务菜单中看不到该服务。

所以我决定回到“MySql Installer -Community”应用程序(我安装了SQL的社区版本)

在此处输入图像描述

安装程序打开后,我单击了 MySQL 服务器的“重新配置”操作

< a href="https://i.sstatic.net/PTMvv.png" rel="nofollow noreferrer">输入图像描述这里

它打开了SQL Server的配置窗口,我按照配置过程设置了服务器(原来我在安装MySQL时最初并没有设置它

Heyoo Heyoo. So as of today 19th March 2022 I had this same issue but imma show you how I solved it. My specs before we start:

  • MySql Version: 8.0
  • OS: Windows 10
  • OS Build: 19044.1586

Alright, I'm fairly new to SQL, was following along with a tutorial but when it got to the point of opening the client command line it wouldn't open, it just popped up and closed back; didn't even ask for a password. After watching several tutorials (which were very unhelpful) I noticed from those tutorials that the solution they proffered was to "Active the MYSQL80 service", but that was unhelpful to me because I couldn't see that service in the services menu.

So I decided to go back to the "MySql Installer -Community" App (I installed the community version of SQL)

enter image description here

After the installer had opened up I clicked on the "Reconfigure" action for MySQL Server

enter image description here

It opened the configuration window for the SQL Server and I followed the configuration process to set up the server (turns out I didn't initially set it up when I installed MySQL ????????). After the configuration process was done I went back to the services menu to see if the "MYSQL80" service was there... and it was, I checked to see if it was running; following the instructions from this tutorial. After making sure the service was running I went back to the client command line, it finally opened up, allowed me to input my password, and it's working properly!!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文