Solved

Not able to connect to MySQL from client machine

Posted on 2006-06-28
12
453 Views
Last Modified: 2008-02-01
Hi everybody,

I have successfully installed my first MySQL based VB6 application on the server. I have used the connection string

"DRIVER={MySQL ODBC 3.51 Driver};SERVER=merline;DATABASE=test;USER=merline;PASSWORD=password02;Port=3306;OPTION=3;", which is working absolutely fine on the server.

However, when I try to run the application from a client machine using the connection string "DRIVER={MySQL ODBC 3.51

Driver};SERVER=merline;DATABASE=test;USER=ADMIN;PASSWORD=password02;Port=3306;OPTION=3;", the following error message shows up: "Host '192.168.0.20' is not allowed to connect to this MySQL server.". 'ADMIN' is the host name of the client machine.

I have created the user 'ADMIN' & granted rights to it with the following commands:
CREATE USER 'ADMIN'@'merline.srpfpl.com' IDENTIFIED BY 'password02';
GRANT ALL ON *.* TO 'ADMIN'@'merline.srpfpl.com';

I have also tried replacing 'ADMIN' with '192.168.0.20' in the above 2 commands, but still it doesn't work.

Please help me out.
0
Comment
Question by:utpal_nandi
  • 6
  • 4
  • 2
12 Comments
 
LVL 35

Expert Comment

by:Raynard7
ID: 17007355
If you use mysql administrator - one of the startup options is "disable networking" if this has been chosen then it will not allow you to connect.

The problem does not seem to be one about the user as this generally gives a different message - the host (the computer you are trying to connect from) is not being allowed by the server.

The fact that you are getting the error message you are means that you are actually talking to the server - meaning you have the correct port; it just has a problem with your machine.

0
 
LVL 5

Expert Comment

by:Z03niE
ID: 17007481
universal remote host is noted with '%'.
so instead of 'merline.srpfpl.com' or '192.168.0.20' try '%'.
0
 

Author Comment

by:utpal_nandi
ID: 17007527
What could be the problem with the machine?  Is it hardware problem or OS problem or Firewall blocking the port?  What could be the possiblities?
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
LVL 35

Expert Comment

by:Raynard7
ID: 17007539
As Z03niE said the problem relates to the fact that no users have the ability to connect from that given machine - try % and it should work.

It is not likley to be a problem with the machine.

The fact that you can connect locally means it should be good.

Try

CREATE USER 'ADMIN'@'%' IDENTIFIED BY 'password02';
GRANT ALL ON *.* TO 'ADMIN'@'%';

And see if that works.
0
 

Author Comment

by:utpal_nandi
ID: 17007548
To user universal remote host do I have to run the commands like this?:
CREATE USER '%' IDENTIFIED BY 'password02';
GRANT ALL ON *.* TO '%';
0
 

Author Comment

by:utpal_nandi
ID: 17007553
OK I'll try that
0
 

Author Comment

by:utpal_nandi
ID: 17017189
On trying:

CREATE USER 'ADMIN'@'%' IDENTIFIED BY 'password02';
GRANT ALL ON *.* TO 'ADMIN'@'%';

I got the following error message on trying to connect to MySQL server from the machine 'ADMIN':

MySQL ODBC 3.51 driver access denied for user 'admin'@'ADMIN' (using password 'YES').
0
 
LVL 35

Expert Comment

by:Raynard7
ID: 17021891
Try

update mysql.user set user='ADMIN', host='%', select_priv='Y', insert_priv='Y', update_priv='Y', delete_priv='Y', create_priv='Y', drop_priv='Y', reload_priv='Y', shutdown_priv='Y', process_priv='Y', file_priv='Y', grant_priv='Y', references_priv='Y', index_priv='Y', alter_priv='Y' where user='ADMIN' and host='%'

as your query,

also remembering that usernames can be case sensitive - so ADMIN is different to admin
0
 

Author Comment

by:utpal_nandi
ID: 17023688
Even after running the update command, I still get the same error message:
MySQL ODBC 3.51 driver access denied for user 'admin'@'ADMIN' (using password:YES).

0
 
LVL 35

Assisted Solution

by:Raynard7
Raynard7 earned 250 total points
ID: 17025105
You need to change 'admin'@'ADMIN' to 'ADMIN'@'ADMIN' if you use lowercase admin and there is no user 'admin' just 'ADMIN' you will have problems
0
 
LVL 5

Accepted Solution

by:
Z03niE earned 250 total points
ID: 17028747
well, the good news is technically you have succeded connecting your client application to the server.The problem now is only the login permission.
What you need to do are :

1. try "select * from mysql.user" using root pass from the server.
Make sure that user "admin" has "%" as host.
2. If the above is correct and the client still can't connect then make sure that you use the correct password in the application.
0
 

Author Comment

by:utpal_nandi
ID: 17029387

Finally the following worked:

CREATE USER 'admin'@'%' IDENTIFIED BY 'password02';
GRANT ALL ON *.* TO 'admin'@'%';

The problem was with the case.  Many many thanks to both!!
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
myqsl update statement on phpMyAdmin 8 37
MS Access - need to reduce row size 25 60
INDEX does not make a difference, why? 10 60
Currency in SQL? 2 30
As a database administrator, you may need to audit your table(s) to determine whether the data types are optimal for your real-world data needs.  This Article is intended to be a resource for such a task. Preface The other day, I was involved …
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://…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

860 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