Link to home
Start Free TrialLog in
Avatar of piratepatrol
piratepatrolFlag for United States of America

asked on

Problem Connecting to MySQL from AS

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
Avatar of Lc001tr
Lc001tr

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 ..
Avatar of piratepatrol

ASKER

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.
ASKER CERTIFIED SOLUTION
Avatar of Lc001tr
Lc001tr

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
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
you can write etc/hosts file 192.168.1.0 % .. i think thats it