Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2013-12-11
1
Medium Priority
?
848 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
1 Comment
 
LVL 84

Accepted Solution

by:
Dave Baldwin earned 2000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
Creating a Cordova application which allow user to save to/load from his Dropbox account the application database.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

916 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