简体   繁体   English

Windows cmd上的mysql打开旧版本

[英]mysql from windows cmd opens old version

I use windows and I have previously installed mysql 5.5 for some legacy project, and now I want to use 5.7 for a new one, so I installed 5.7 in another directory, on another port and having different data directory, my problem is when i launch mysql from cmd like: 我使用Windows,以前为某些旧项目安装了mysql 5.5,现在我想为新项目使用5.7,因此我将5.7安装在另一个目录中,另一个端口上并具有不同的数据目录,我的问题是启动时来自cmd的mysql如下:

W:\MySQL57\bin> mysql -u root -p

It results in this: 结果是:

W:\MySQL57\bin>mysql -u root -p
Enter password: *****
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.5.54-log MySQL Community Server (GPL)

And I am definitely sure that MySQL57 is directory for 5.7 MySQL, so what's wrong with mysql command line tool and how can i fix it to be able to use both mysqls in cmd? 而且我绝对可以肯定MySQL57是5.7 MySQL的目录,因此mysql命令行工具出了什么问题,我该如何修复它才能在cmd中使用两个mysql?

The mysql command you are using is probably the 5.7 version, you can check this with : 您正在使用的mysql命令可能是5.7版本,您可以使用以下命令进行检查:

W:\MySQL57\bin>mysql -v

But this is just the client ! 但这只是客户!

The problem is your server version, you may have 2 versions running (5.5 and 5.7), and as you haven't specified the port you are using the default one which is used by the first server (5.5). 问题在于您的服务器版本,您可能正在运行2个版本(5.5和5.7),并且由于未指定端口,因此您使用的是默认端口,该端口是第一台服务器使用的默认端口(5.5)。 Try to find the port for the second version (3307 ?) or kill the 5.5 server when you are connecting to the 5.7. 尝试找到第二个版本的端口(3307吗?),或者在连接到5.7时终止5.5服务器。

You are calling the default mysql set in Environment Variable. 您正在调用环境变量中设置的默认mysql。 If you want to use a specific mysql, you need to provide the path too 如果要使用特定的mysql,也需要提供路径

W:\MySQL57\bin>"W:\MySQL57\bin\mysql" -u root -p

In case of mysql not working, you can call mysqld . 如果mysql无法正常工作,则可以调用mysqld

If you want mysql 5.7 to be default, just change it from Environment Variable https://dev.mysql.com/doc/mysql-windows-excerpt/5.7/en/mysql-installation-windows-path.html 如果您想将mysql 5.7设置为默认值,只需从环境变量https://dev.mysql.com/doc/mysql-windows-excerpt/5.7/en/mysql-installation-windows-path.html对其进行更改

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

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