Solved

can't connect to mysql database locally but can connect to remotely

Posted on 2013-12-11
1
828 Views
Last Modified: 2013-12-17
Dear esteem experts:

I got a funny situation here for my Mysql database server. I can connect to this database from a remote server but can't through local terminal.

here is the output I got:

[root@hera ~]# mysql -u root -h localhost -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[root@hera ~]#

---------------------------------------------------
but I can connect through a windows server:

C:\Program Files\MySQL\MySQL Server 5.5\bin>mysql -u root -p -h hera.minkagroup.
net
Enter password: ********
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8871
Server version: 5.1.61 Source distribution

Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>



--------------------------------------
I guess my predecessor set up some permission limit like only permit "root" user to connect from a specific machine. Would you guys help me trouble shoot this.

thank you.
0
Comment
Question by:Jason Yu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 39712606
MySQL users are created with a username, password, and connection.  It sounds like the 'localhost' version of 'root' has been deleted and the remote connection version has been created.  I suggest you use the remote login to create a localhost copy of the 'root' user with the same password but 'localhost' as the connection.

It is Strongly advised that you do not allow a remote connection as 'root' because 'root' can do... or Undo everything.  Remote users should have more limited privileges so they can't destroy you databases and server.

More info here: http://dev.mysql.com/doc/refman/5.5/en/adding-users.html
0

Featured Post

Get Database Help Now w/ Support & Database Audit

Keeping your database environment tuned, optimized and high-performance is key to achieving business goals. If your database goes down, so does your business. Percona experts have a long history of helping enterprises ensure their databases are running smoothly.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently I was talking with Tim Sharp, one of my colleagues from our Technical Account Manager team about MongoDB’s scalability. While doing some quick training with some of the Percona team, Tim brought something to my attention...
This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question