Somjit
Somjit

Reputation: 2772

Using SublimeText2 as MySql query editor

Following these two links and this youtube video, i tried to make SublimeText 2 as the editor for MySql . However , i can't seem to get it to work. Build happens , but i dont get any output on the file i selected. Nor do i get any output on any command shell/console.

My build file :

{
    "cmd": ["mysql", "-u", "root", "-p" , "password_here_", 
            "-o", "F:/code/mysql/mysql-data/myHfs/output.txt", "-e", "source $file"],
    "working_dir": "F:/code/mysql" 
    "selector": "source.sql"
}

Screenshots:


Upvotes: 0

Views: 1105

Answers (2)

SohailAQ
SohailAQ

Reputation: 1038

I do not think it is necessary to have that many parameters in the build file. This is my build file and am able to execute the .sql file using Ctrl+B. (I am on Windows btw)

{
"cmd": ["C:\\xampp\\mysql\\bin\\mysql", "-uroot", "-pMyPassword", "-e", "source $file", "-v", "-t"],
"selector": "source.sql"
}

Upvotes: 1

user1516366
user1516366

Reputation:

Perhaps you are mistakenly using -o. The MySQL docs say:

--one-database, -o

Ignore statements except those that occur while the default database is the one named on the command line. This option is rudimentary and should be used with care. Statement filtering is based only on USE statements.

I think you are trying to write the output to a file but I don't know that you can do it using the "cmd" portion of the build file. Normally, with a CLI you would redirect the output using >. That doesn't work here. I also tried using the tee option but apparently tee only works in interactive mode.

One option is to select your queries into an outfile in the source file but that's not very global:

SELECT * INTO OUTFILE '/tmp/whatever.txt' FROM player;

Upvotes: 0

Related Questions