Solved

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

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

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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Creating and Managing Databases with phpMyAdmin in cPanel.
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…

760 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