简体   繁体   English

已安装XAMPP但无法连接到cmd中的MYSQL服务器

[英]Installed XAMPP but can't connect to MYSQL server in cmd

First, MYSQL services is running in XAMPP and, YES, I changed the port since it conflicts with other applications Now, the question is why can't i connect to MYSQL? 首先,MYSQL服务在XAMPP中运行,是的,我改变了端口,因为它与其他应用程序冲突现在,问题是为什么我不能连接到MYSQL?

Error 2003: Cant connect to MYSQL server on 'localhost' 错误2003:无法连接到'localhost'上的MYSQL服务器

I also dont have any mysql services installed. 我也没有安装任何mysql服务。

Please help. 请帮忙。 Thank you for those people who would answer me :) 谢谢那些能回答我的人:)

First,make sure mysqld is running. 首先,确保mysqld正在运行。

ps -ef |grep mysql

Second,get the socket file in the output of last command: 其次,在last命令的输出中获取套接字文件:

for example:--socket=/opt/lampp/var/mysql/mysql.sock

Then,try to connect to mysql: 然后,尝试连接到mysql:

mysql -uroot -p -P<port> -hlocalhost -S /opt/lampp/var/mysql/mysql.sock

option 1. 选项1。

  1. Goto /bin/ 转到/ bin /
  2. Run mysqld (service) 运行mysqld(服务)
  3. close the cmd prompt 关闭cmd提示符
  4. Run mysql.exe (make sure you add the location path to PATH environment Variable) 运行mysql.exe(确保将位置路径添加到PATH环境变量)

Option 2. try to follow this thread and see if it can help!! 选项2.尝试遵循此线程,看看它是否可以帮助!! http://forums.devshed.com/mysql-help-4/error-2003-cant-connect-mysql-server-localhost-10061-a-26423.html http://forums.devshed.com/mysql-help-4/error-2003-cant-connect-mysql-server-localhost-10061-a-26423.html

Run mysql.exe (make sure you add the location path to PATH environment Variable) 运行mysql.exe(确保将位置路径添加到PATH环境变量)

I would to know where is PATH enviroment variable 我想知道PATH环境变量在哪里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM