Access mySQl

I can use workbench to access a mysql instance with username and password
without problem.  When I try through ssh using mysql -u xoxomos -h testdb3 -p
i am prompted for password. When i enter password
ERROR 1045 (28000): Access denied for user 'xoxomos'@'testdb3' (using password: YES)
Same password, username and server.  How do i avoid this problem?  RH6
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mark BullockQA EngineerCommented:
What command did you use to set up the port forwarding?
Do you have a mysql server running on the machine where you run the mysql command?
you have to check what your settiings for the user are.
select * from mysql.user where user='xoxomos';

the error says that without specifing a DB the user is not able to connect from testdb3.

using workbench manage the USers on the db username@hostname from which it can connect and to which database to which the user can connect.
Dave BaldwinFixer of ProblemsCommented:
A MySQL login consists of 3 parts:  username, password, and host.  The host for MySQL Workbench and SSH are probably different.  I would think that SSH would be logging in from 'localhost'.  You may have to add another user, usually with the same username and password, but with 'localhost' as the host setting.
Protecting & Securing Your Critical Data

Considering 93 percent of companies file for bankruptcy within 12 months of a disaster that blocked access to their data for 10 days or more, planning for the worst is just smart business. Learn how Acronis Backup integrates security at every stage

Database name is part of authentication under certain circumstances.

-h is what controls. If you are on the system where mysql is running, there is no need to use -h (localhost) is implied.
Thought the user settings still control.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
xoxomosAuthor Commented:
I've tried from command line using just mysql -u xoxomos with the same results.  It ask for password and gives the same message as mysql -u xoxomos -h localhost -p.
xoxomosAuthor Commented:
By any chance does mySQL look at the table called servers at all as part of the authentication process? Can't understand why workbench allows access with the same username, password i'm trying to access from command line.
not sure what you are looking at,
mysql uses the mysql DB user, host and db tables to authorize a user.

the determinant is what rights the user has in user, then options there decide/influence whether host and db is consulted.
xoxomosAuthor Commented:
Thanks all.  Looks like the difficulty I was having was due to the fact that in the my.cnf file or some file i looked at the sysadm has my username and the ip address of my desktop included .  I'm guessing the intent is to allow only certain machines to access.  In addition i have a userid on the mySQL server machine.  I could access the database from my desktop with no problem using workbench.  I then tried logging into the server machine which resulted in this question.  Not being the sharpest knife in the drawer it took a while for me to convince myself to try logging in from the DOS command prompt on my desktop which worked on first try.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
MySQL Server

From novice to tech pro — start learning today.