How to use the --verbose flag in the MySQL 5.6 command line client?

不羁的心 提交于 2019-12-10 03:06:01

问题


Going by the list of flags here, with the line at the top about usage: Usage: mysql [OPTIONS] [database].

I am running Windows 8; my table is "contact"; I want to create a tee file for source C:/myfile.sql with the verbose option on.

I have tried mysql -v contact, -v contact, --verbose contact, --verbose source C:/myfile.sql, and various others.

EDIT: adding screenshot of where I'm trying to run this, in case it helps.


回答1:


The correct syntax for a verbose interactive session is:

c:\> mysql -u yourUser -p -v yourDatabase

This will launch an interactive session (prompting you for password), and set yourDatabase as the default database for the session.

Once in this interactive session, issue a tee command:

mysql> tee c:/temp/my.out

And now you can source your script:

mysql> source c:/myfile.sql

Of course, you can avoid all this pain by simply putting this in your command prompt:

c:\> mysql -u yourUser -pYourPassword -v yourDatabase < myfile.sql > my.out

This will:

  1. Push the contents of myfile.sql to an "interactive" mysql session... that's essentially a batch process
  2. Redirect all contents of the batch process to my.out

Reference:

  • MySQL Reference Manual: mysql CLI: mysql options



回答2:


That should work, be aware of the db name.

mysql -v contact

If you db requires login:

mysql -v -udbuser -p contact


来源:https://stackoverflow.com/questions/29959112/how-to-use-the-verbose-flag-in-the-mysql-5-6-command-line-client

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!