Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ODBC Not Configured, Not Asking for Password

Status
Not open for further replies.

parx87

MIS
Sep 25, 2008
3
US
I've done a bit of searching on this and can't find anyone with my exact issue.

When I type mysql at the command prompt, and do not specify a username or password, it automatically connects using ODBC@localhost, and doesn't require a password of any kind. I can specify root and it does ask for a password, and works, but I don't want this ODBC to work without a password.

I haven't configured any ODBC setup on my machine, so I'm not sure how this came to be, or where I can disable/set a password, since my ODBC configuration is empty?

Any help would be appreciated
 
mysql the client program expects to be passed a series of arguments.
If you omit to pass any arguments you can see what it is using instead if you try
mysql --print-defaults
You can change these defaults in my.cnf or my.ini of better still get used to calling the program with at least a few arguments so it does not need to guess what you might be trying to do.

If I just type mysql I get
Access denied for user 'ODBC@localhost' <using password: NO>
you will have discovered it will assume you want to connect to local host as the user 'ODBC' with no password in other words...

mysql -u ODBC h localhost

As a minimum you need to set up your permissions to ensure that you do not give access to anyone without a password.

select host,user,password from mysql.user;

and make sure you do not have any users you dont want or any users with a blank password.
 
Thank you hvass, your comment lead me to finding the answer!

After investigating the user table, there's an entry for localhost where the username is blank. After issuing the following command:

Code:
 set password for ''@'localhost' = password('****');

now when I try to connect without specifying a user, I get an access denied instead of taking me in without credentials.

Thank you very much for your guidance :)
 
In general I would recommend deleting any rows in mysql.user where any of host, user, password is blank or uses the wild character %. Then specifically grant for any users you want.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top