• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 379
  • Last Modified:

Enable remote mysql access

I have set my.cnf to bind to my ip.
I have commented out "skip-networking"
I can't connect, it's probably something quite basic, because:

Zelda # telnet 192.168.0.35 3306
Trying 192.168.0.35...
Connected to 192.168.0.35.
Escape character is '^]'.
EHost '192.168.0.35' is not allowed to connect to this MySQL serverConnection closed by foreign host.
0
letharion
Asked:
letharion
  • 3
  • 3
  • 2
1 Solution
 
ChristoferDutzCommented:
You have to explicityl allow a user to connect from a certain ip or "%" for all machines.
0
 
K VDatabase ConsultantCommented:
Have you grant permission for user @ that host?
GRANT ALL ON DBNAME.*  TO  'user'@'192.168.0.35'  IDENTIFIED BY 'PASSWORD';
0
 
letharionAuthor Commented:
mysql> select user, password, host from user where user ="letharion";
+-----------+-------------------------------------------+--------------+
| user      | password                                  | host         |
+-----------+-------------------------------------------+--------------+
| letharion | *1F741C2CC5E5B34C1809CEC44DF4AB62D3D72BB2 | localhost    |
| letharion | *1F741C2CC5E5B34C1809CEC44DF4AB62D3D72BB2 | 127.0.0.1    |
| letharion | *1F741C2CC5E5B34C1809CEC44DF4AB62D3D72BB2 | 192.168.0.35 |

I figured maybe I was rejected before this table was even read as I never gave a username.
Is anything wrong with this layout?
0
Restore individual SQL databases with ease

Veeam Explorer for Microsoft SQL Server delivers an easy-to-use, wizard-driven interface for restoring your databases from a backup. No expert SQL background required. Web interface provides a complete view of all available SQL databases to simplify the recovery of lost database

 
ChristoferDutzCommented:
Ähem ... the user is connecting TO a DB on 192.168.0.35, so you'd propably have to use the client's IP instead or use "%" for any host.
0
 
letharionAuthor Commented:
>>Have you grant permission for user @ that host?
I could have sworn I had tried that, but I wanted to start from the beginning, so I just mentioned the telnet.
Could it have made a difference that I didn't use '' around the username?

That fixed it in any case. Thanks
0
 
letharionAuthor Commented:
>>Ähem ... the user is connecting TO a DB on 192.168.0.35, so you'd propably have to use the client's IP instead or use "%" for any host.

You're ofc correct. But I was trying locally first :)
The grant command fixed it locally, and I added the external ip and now that works too.
0
 
K VDatabase ConsultantCommented:
yes for sure
0
 
K VDatabase ConsultantCommented:
Could it have made a difference that I didn't use '' around the username? << yes for sure
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

  • 3
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now