mysql - e 标志和特殊字符在 mysql 中起什么作用?

标签 mysql sql database batch-processing mysql-5.7

我正在学习mysql http://dev.mysql.com/doc/refman/5.7/en/batch-mode.html 。第二段说:

If you are running mysql under Windows and have some special characters in the file that cause problems, you can do this:

C:\> mysql -e "source batch-file"
  • 什么是特殊字符?如果我在记事本中保存文件,文件中是否会自动保存特殊字符?如何知道它们是否存在?它们被隐藏了吗?

  • -e 标志有什么作用?在mysql文档中哪里可以找到它的解释?

最佳答案

-e 实际上是 --execute 的缩写,这可能就是您找不到它的原因。 http://dev.mysql.com/doc/refman/5.7/en/mysql-command-options.html#option_mysql_execute

Execute the statement and quit. The default output format is like that produced with --batch. See Section 5.2.4, “Using Options on the Command Line”, for some examples. With this option, mysql does not use the history file.

特殊字符是在 SQL 查询中需要转义的字符。当你遇到它们时你就会知道,因为 mysql 会产生错误。

关于mysql - e 标志和特殊字符在 mysql 中起什么作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39463110/

相关文章:

php - 如何防止 MySQL 使用 PDO 更新带有空字符串的列

ruby-on-rails - 在 rails db 中存储星期几(星期一、星期二、星期三、...)并与今天的日期进行比较

mysql - 如何连接 3 个表,其中 2 个表与另外 1 个表相连,但彼此不相连

sql - 将 guids 转换为数值

PHP 使用 ORDER BY 查询 MySQL 对数据库项目进行排序

php - Mysql 获取今天日期和 future 的结果

mysql - 将具有相同数据的行合并为一行并将数字相加

mysql - 连接到 MySQL 服务器无法正常工作

SQL 将日期转换为工作日名称

sql - MySql随机类别有限选择