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


Problem Connecting to MySQL from AS

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

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

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

I get the following error:

ERROR [HYT00] [MySQL][ODBC 3.51 Driver]Host '' 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
Question by:piratepatrol
  • 3
  • 3

Expert Comment

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 ..

Author Comment

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.

Accepted Solution

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 ..

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


Author Comment

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.

Author Comment

ID: 12724669
Hi Lc001tr,

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

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@' (Using password: NO) is my Windows computer, and is my Linux computer (with MySQL).  Any thoughts on this?


Expert Comment

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

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