简体   繁体   English

从控制台(例如cmd.exe)运行mysql和mysqlsh有什么区别?

[英]What is the difference between mysql when run from the console (eg cmd.exe) and mysqlsh?

On Windows I can run 在Windows上,我可以运行

C:\WINDOWS\system32>mysql -u root -pxxxx

or alternatively there is a shell-like program at "MySQL Shell xy\\bin\\mysqlsh.exe" 或者在"MySQL Shell xy\\bin\\mysqlsh.exe"有一个类似shell的程序

What is the difference, in high-level terms, between these two? 从高级的角度来讲,两者之间有什么区别? When would you use one over the other, and why? 您什么时候可以使用另一个,为什么? I have a lot of experience with sqlplus on Oracle; 我在Oracle上使用sqlplus有很多经验; is the mysqlsh like sqlplus, in the sense that it provides much more functionality than console access that is possible through cmd.exe? mysqlsh是否像sqlplus,在某种意义上说它提供的功能比通过cmd.exe进行的控制台访问要多得多?

Thanks in advance. 提前致谢。

MySQL Shell is a superset of the functionality of the mysql client. MySQL Shell是mysql客户端功能的超集。 It has several features that the old client doesn't have, for example: 它具有旧客户端不具备的几个功能,例如:

  • You can write statements in Python or Javascript in addition to SQL statements, so you can write scripts that do any kind of loop or conditional code you can imagine in Python or Javascript. 除了SQL语句外,您还可以用Python或Javascript编写语句,因此您可以编写执行Python或Javascript可以想象的任何循环或条件代码的脚本。

  • You can connect to multiple MySQL sessions concurrently, for example to connect to multiple servers. 您可以同时连接到多个MySQL会话,例如,连接到多个服务器。

  • You can output query results in different formats, including JSON. 您可以输出不同格式的查询结果,包括JSON。

  • You can use the "X Protocol" which allows you to query MySQL like a NoSQL server instead of an SQL server. 您可以使用“ X协议”来查询MySQL,例如NoSQL服务器而不是SQL服务器。

MySQL Shell is sort of being presented as a successor to the traditional mysql client tool. MySQL Shell可以作为传统mysql客户端工具的后继产品提供。 But it's a relatively new tool and probably has some undiscovered bugs (any new software does). 但这是一个相对较新的工具,并且可能存在一些未发现的错误(任何新软件都存在)。

The old mysql tool is not going away. 旧的mysql工具不会消失。 There are too many apps and scripts that make extensive use of that old client tool, and while the new MyQL Shell can do the same tasks, the usage is different, so for backward compatibility, I assume the old tool will exist forever. 太多的应用程序和脚本大量使用了旧的客户端工具,而新的MyQL Shell可以执行相同的任务,但是用法不同,因此为了向后兼容,我认为旧工具将永远存在。

For more information, see: https://dev.mysql.com/doc/mysql-shell/8.0/en/mysql-shell-features.html 有关更多信息,请参见: https : //dev.mysql.com/doc/mysql-shell/8.0/en/mysql-shell-features.html

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

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