Solved

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

Posted on 2013-12-11
1
800 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 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
Shadow IT is coming out of the shadows as more businesses are choosing cloud-based applications. It is now a multi-cloud world for most organizations. Simultaneously, most businesses have yet to consolidate with one cloud provider or define an offic…
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…

911 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now