如何在Linux终端中输出sql查询?

时间:2016-06-08 12:37:12

标签: mysql

我在终端上写了sql查询。我无法找到该查询的输出。任何人都可以从我获得输出的地方帮助我。

2 个答案:

答案 0 :(得分:1)

您可以在终端上运行查询,如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
  <persistence-unit name="StudentEJBPU" transaction-type="JTA">
    <jta-data-source>jdbc/sample</jta-data-source>
    <class>entities.Student</class>
    <exclude-unlisted-classes>false</exclude-unlisted-classes>
    <properties>
      <property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/>
    </properties>
  </persistence-unit>
</persistence>

答案 1 :(得分:0)

当你在mysql终端使用时:

mysql> \T /tmp/query.out
Logging to file 'query.out'

所有查询输出都将存储在 /tmp/query.out 文件中。