dbext without a password

72 views
Skip to first unread message

Paul

unread,
Feb 22, 2015, 11:37:41 AM2/22/15
to vim...@googlegroups.com
How can I use dbext.vim without a MySQL password? I've tried using

let g:dbext_default_profile_mySQL = 'type=MYSQL:user=root:dbname=test'

and

let g:dbext_default_profile_mySQL = 'type=MYSQL:user=root:passwd=:dbname=test'

and

DBSetOption passwd=''

and clearing @afkb at the prompt when using \sbp. It always gives

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

I could set 'user' and no 'password' in ~/.my.cnf, but that's not manageable.

David Fishburn

unread,
Feb 22, 2015, 12:43:03 PM2/22/15
to vim_use
When using type=MYSQL, dbext shells out and runs the mysql binary, which you typically see when there is an error:

Last command(rc=1):
mysql.exe  -u root -D mysql -t < D:\WINDOW~1\dbext.sql


Outside of dbext, can you concoct a mysql command line that does what you want without using a password.  That usually helps when coming up with the connection profile that will result in the same command line.

You can also see the dbext command line by running:
:DBSetOption display_cmd_line=1

HTH,
David



Paul

unread,
Feb 25, 2015, 12:03:03 PM2/25/15
to vim_use
On Sunday, 22 February, 2015 at 17:42:55 GMT, David Fishburn wrote:
>Outside of dbext, can you concoct a mysql command line that does what you
>want without using a password. That usually helps when coming up with the
>connection profile that will result in the same command line.
>
>You can also see the dbext command line by running:
>:DBSetOption display_cmd_line=1

With that DBSetOption, I can see that the command dbext is using is:

mysql -u root -D test -t < /tmp/vplBhqM/dbext.sql

I have previously defined some other mysql user and password in ~/.my.cnf. With the above command line, mysql, since there is no password parameter given, [I'm assuming] takes the password from ~/.my.cnf, which is not necessarily the password of the root user. I think this is a failing of mysql rather than dbext. A command that does is:

mysql -u root --password='' -D test -t < /tmp/vplBhqM/dbext.sql

Note that -p doesn't accept a blank password (it'll prompt), but --password does.

Paul

unread,
Feb 25, 2015, 12:04:40 PM2/25/15
to vim_use
On Wednesday, 25 February, 2015 at 17:02:39 GMT, Paul wrote:
>I have previously defined some other mysql user and password in ~/.my.cnf. With the above command line, mysql, since there is no password parameter given, [I'm assuming] takes the password from ~/.my.cnf, which is not necessarily the password of the root user. I think this is a failing of mysql rather than dbext. A command that does is:

That should be, "A command that does work is"!

David Fishburn

unread,
Feb 25, 2015, 2:54:00 PM2/25/15
to vim_use
Okay, great, now you have a mysql command line which works as you want.

Were you able to create a dbext profile that will add that?

If you create the following profile in your .vimrc:

let g:dbext_default_profile_mysql_no_password = "type=MYSQL:user=root:passwd=:dbname=mysql:extra=--password='' "

Then for me this produced the following mysql command line:

mysql  -u root -D mysql --password=''  < D:\WINDOW~1\dbext.sql


This one indicated to used the -t (tabbed) output:

let g:dbext_default_profile_mysql_no_password_tabbed = "type=MYSQL:user=root:passwd=:dbname=mysql:extra=-t --password='' "


Thanks for getting back to the list.  I will update the dbext.txt with this example.


HTH,
David

 

Paul

unread,
Feb 26, 2015, 11:39:31 AM2/26/15
to vim_use
On Wednesday, 25 February, 2015 at 19:53:49 GMT, David Fishburn wrote:
>let g:dbext_default_profile_mysql_no_password =
>"type=MYSQL:user=root:passwd=:dbname=mysql:extra=--password='' "

Yep, this works for me, too. Thank you.
Reply all
Reply to author
Forward
0 new messages