[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Problem Connecting to MySQL from AS

Posted on 2004-11-07
6
Medium Priority
?
484 Views
Last Modified: 2012-06-22
Hi friends,

I have Windows XP running IIS in 192.168.1.100, and I'm using ASP.NET to connect to a MySQL DB in a Linux computer at 192.168.1.101.  My code is

OdbcConnection cn = new OdbcConnection("Driver={MySQL ODBC 3.51 Driver}; Server=192.168.1.101; Port=3306; Option=3; Database=Jazon; Uid=root; Password=;");
cn.Open();

I get the following error:

ERROR [HYT00] [MySQL][ODBC 3.51 Driver]Host '192.168.1.100' is not allowed to connect to this MySQL server

I have the MyODBC 3.5 driver installed in the Windows computer, and I know MySQL is running properly because I'm able to connect and query it from a PHP page in the Linux computer.

Any help would be so greatly appreciated,


Jazon from Jacksonville, FL
0
Comment
Question by:piratepatrol
  • 3
  • 3
6 Comments
 

Expert Comment

by:Lc001tr
ID: 12522551
i think you are running php code on sam machine which runs mysql server.. so u use local user to communicate with mysql you need to create a remote user ..
you need to create a user, use mysql front (http://www.mysqlfront.de) and create user and dont select localhost but write there (in the domain part) '%' which means user can use server from outside of that computer or change rules for root user.. make it % not localhost

user data is saved under a table in mysql =>  database > mysql > users or something like that you can edit it manually too but i can tell you that using mysql front is much more simpler..

ps: if you use fedora or rh 8-9 check /etc/hosts file ..
0
 
LVL 3

Author Comment

by:piratepatrol
ID: 12524215
There's a root user in the user table.  Its Host was localhost.  I updated that to % with an update query.  I still get the same problem.  (I use this root to log in from the .aspx page).  Where am I going wrong?  This bites.
0
 

Accepted Solution

by:
Lc001tr earned 1000 total points
ID: 12524862
can u try to create another user and change the code from aspx ?
so try it in that way too..
and btw can you connect to mysql server from your computer (which runs aspx) with mysql front or some other clients ?  please a new user give all permissions  host = % and retry with aspx and then with mysqlfront ..
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 3

Author Comment

by:piratepatrol
ID: 12724577
Hi Lc001tr,

I made the following insert into mysql > user ...

insert info user values ('%', 'jazon', 'pwd', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', );

In my PHP, I have

$cn = @mysql_connect("%", "jazon", "pwd");

With these, I am unable to connect to MySQL from PHP.  Any thoughts?  

Thank you so much.
0
 
LVL 3

Author Comment

by:piratepatrol
ID: 12724669
Hi Lc001tr,

I added the following line to /etc/hosts, and now it works:

127.0.0.1            %

My connection string is

$cn = @mysql_connect("%", "root", "");

I can now connect to MySQL from PHP again.  However, I now have a new problem with my connection from my aspx page:

ERROR [HYT00] [MySQL][ODBC 3.51 Driver]Access denied for user: 'root@192.168.1.100' (Using password: NO)

192.168.1.100 is my Windows computer, and 192.168.1.101 is my Linux computer (with MySQL).  Any thoughts on this?

Thanks......Jazon
0
 

Expert Comment

by:Lc001tr
ID: 12734083
you can write etc/hosts file 192.168.1.0 % .. i think thats it
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Ready to get certified? Check out some courses that help you prepare for third-party exams.
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses
Course of the Month19 days, 13 hours left to enroll

872 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