Loading ...
Sorry, an error occurred while loading the content.

Re: Stuck & confused (vim and mysql)

Expand Messages
  • Dave Price
    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
    Message 1 of 2 , Mar 14, 2007
    • 0 Attachment
      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
    • Jorge Ferrando
      Hi! I ve just installed the last release of mac-vim. I love the new tabs feature and I was wondering if it would be possible to configure the system to open
      Message 2 of 2 , Mar 15, 2007
      • 0 Attachment
        Hi!

        I've just installed the last release of mac-vim. I love the new tabs
        feature and I was wondering if it would be possible to configure the
        system to open files in a new tab of the existing vim windows instead
        of opening a different window for each file.

        Is it possible?

        Thanks!!

        Jorge Ferrando.
      Your message has been successfully submitted and would be delivered to recipients shortly.