Q:

problems with mysql connector c++ on linux

say my ip adress is 127.0.0.1:8081 with user root and password root
and i want to connect to mysql via c++
this is working via browser and 127.0.0.1:8081/phpmyadmin/ where i can type in my password and user name and select a server, for instance i select server C
going by the example on the web page I am unable to connect to the server with the following error
driver = get_driver_instance();
  con = driver->connect("tcp://127.0.0.1:3306", "root", "root");
  /* Connect to the MySQL test database */
  con->setSchema("test");

# ERR: Lost connection to MySQL server at 'reading initial communication packet', system error: 0 (MySQL error code: 2013, SQLState: HY000 )
success

What am i doing wrong? Am i supposed to specific the server as well?
edit:
the only information the website gives me is
 Server: C via TCP/IP
    Server version: 5.1.63-0ubuntu0.11.10.1
    Protocol version: 10
    User: root@website.com
    MySQL charset: UTF-8 Unicode (utf8)

A:

If I read you right, you have an http server answering to point 3306, not mysql. You should find out what port your mysql is listening to. Perhaps, you can find it in phpmyadmin setup for server C.
But generally, this sounds like a weird setup and you're doing wrong more or less everything.

