I am trying to access a Mysql Server through Lan using VB6
using ADODB connection

db.Open "DRIVER={MySQL ODBC 5.1 Driver};DATABASE=xxxx;SERVER=;USER=root;PASSWORD=xxxx;OPTION=3;"

it is giving error

[Mysql][ODBC 5.1 Driver]host couldn't connect to the Mysql Server

My Server IP is :
user is: root

Firewalls are turned off....
Might be i need to allow lan access in my sever Mysql. I dont know how to do it

Can anyone give me a solution to this problem..

Recommended Answers

All 10 Replies

i dont know whether root can be accessed locally or not..
if not then what is the alternative and what i have to do in order to access it locally

Create a new user with remote access priviliges, or change the priviliges of root (not recommended).

Create a new user with remote access priviliges, or change the priviliges of root (not recommended).

can u give me exact code to create a user with remote access priviliges...

thank you

Yes you can most certainly connect to mySql using root. It took me about a week to find the solution to the same problem and with many posts. Funny, none of the posts could help. It was eventually the MySql ref. manual that gave the answer - you need to reset the roots password and permissions.

The link below gives you a step by step which worked for me. The second link gives you more options as well, although the first was fine for me.



I hope this solves your problem without as many headaches as I incurred.:D

one more thing... if i am installing mysql on a new system which ll be used as server... what command should i give at that time to give privleges to the root user.

m still unable to connect to the mysql server after flushing privleges also.. as it was given in the link posted above..

Deepmadan, as I said previously, I had major headaches sorting it. I have un-installed MySql completely and then went and re-installed to all its default values. I have then flushed privelages and it worked for me. I am attaching a small sample that I am using in vb6 to connect and create my tables. Try it out and see if it works for you. It is quite rough, because I have used this as a sample and from there I started my application. It test connection, shows databases and tables.

You can also download MySqlcc (just search for it) which connects to MySql, and it is much better than the MySql management console.

You will also note that I have used older drivers, 3.51, but that should not make a difference.

I really hope you find the solution because I know what you are going through.:D

thanks for ur help..
i just created another user and granted it rights for that database.
my problem is solved

Only a pleasure.

Happy coding...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.