Solved

Lost user connectivity when MySQL is binded with IP address.

Posted on 2016-09-05
5
23 Views
Last Modified: 2016-09-11
Hello,

I have used bind-address option in MySQL config file which stopped my connectivity to mysql instance on specific user. I have figured it out that the user is created with host as "localhost". I'm able to fix this issue by updating the user Host field with binded ip or using wildcard '%' (any ip).

I'm trying to understand is there is any possible security issue using wild card '%' to allow on any IP or it is recommended to bind with specific IP?

Also, what is recommended approach for high privileged user accounts like root & mysql.sys?

Thank you
0
Comment
Question by:Siva Dasari
  • 2
  • 2
5 Comments
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 41785269
'root' is normally restricted to one of versions of 'localhost', '127.0.0.1' (IPv4 format), or '::1' (IPv6 format).  That requires the 'root' user to be logged into the machine that the server is on.
0
 
LVL 77

Expert Comment

by:arnold
ID: 41785271
Adding to Dave's point, you can create other users who can be accessing from any (%) source while restricting what they can do on the system.
0
 

Author Comment

by:Siva Dasari
ID: 41785322
I tried to do the following as per your comments but ended with an error, could you please let me know if i'm missing something here ...

mysql> UPDATE mysql.user SET HOST="127.0.0.1" WHERE user="root";
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.02 sec)
mysql> exit
Bye

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

Open in new window

0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 41785345
Please read the  --bind-address section on this page: http://dev.mysql.com/doc/refman/5.7/en/server-options.html   The default value is '*' which allows the server to connect on any IP address or hostname.  It is probably better to use '*' and restrict access in the 'privileges' where you can limit users to specific IP addresses without blocking the entire server.
0
 
LVL 77

Expert Comment

by:arnold
ID: 41785395
Changing the host, does not set a password, which seems that root might not have a password
mysql -u root
See if it loggs you in.
select * from mysql.user where User='root';

Also, usually the host us localhost, versus the equivalent 127.0.0.1.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Fore-Foreword Today (2016) Maxmind has a new approach to the distribution of its data sets.  This article may be obsolete.  Instead of using the examples here, have a look at the MaxMind API (https://www.maxmind.com/en/geolite2-developer-package). …
Foreword This is an old article.  Instead of using the MySQL extension that was used in the original code examples, please choose one of the currently supported database extensions instead.  More information is available here: MySQLi / PDO (http://…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

792 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