logo       

Re: Stuck & confused (vim and mysql): msg#00032

editors.vim.mac

Subject: Re: Stuck & confused (vim and mysql)

If you in a mysql command shell, you can use \e to launch whatever is
is defined in your $EDITOR (vim, i hope) and edit command - these are
then submitted as if type on the command line - sometimes it seems to
need an extra ; after you ZZ or :wq out of vim,

Alternatively (what I do) is run: mysql mydatabsae < mycommand.sql
from a command promp in another window -

i.e. if I had just saved an SQL file 'update.sql' and wanted to run it
against database 'davep'

my command would be 'mysql davep < update.sql' (take the quotes off ... )

on a mac, option n rotates beween terminal sessions very nicely - I do
the same thing in kde konsole with shift - arrow.

you could do a control-Z in vim to suspend oyu vim session, then fg to
bring vim back to the foreground ... but I find multiple console
sessions to be quicker ...

also ... if your workstation in secure, you can store your user id and
password in ~/.my.cnf - so you do not need the -p ...
for example:

davep@htpc:~/audio]$ cat ~/.my.cnf

[client]
#comments are #'s
#this is my password
user="davep"
password="notreally"
# grant insert,select on cdr.* to 'r0ckyCDr'@'%' identified by
PASSWORD 'notlikely';
#user="r0ckyCDr"
#password="notlikely"

regardless of password ... you can use the same command environment
against a mysql database on a remote server by including a -h switch
...

mysql -h davesdb.kinaole.org davep < update.sql ... would run my
local sql file against database davep on my remote mysql server ...
and display outuput on my
local terminal

Hope this helps.

aloha,
dave



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise