Bug #15266 | mysql_real_connect failed connection | ||
---|---|---|---|
Submitted: | 27 Nov 2005 9:51 | Modified: | 27 Nov 2005 14:48 |
Reporter: | gian enrico conti | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server | Severity: | S2 (Serious) |
Version: | 5.0 | OS: | Windows (XP 64 bit on xeon) |
Assigned to: | CPU Architecture: | Any |
[27 Nov 2005 9:51]
gian enrico conti
[27 Nov 2005 10:01]
Valeriy Kravchuk
Thank you for a problem report. Please, specify the exact version of MySQL used (5.0 is not enough) and what distribution package(s) you installed.
[27 Nov 2005 14:38]
gian enrico conti
I see under mysql ADMIN: server version: 5.015-nt-max via TCP I use the LIB and DLL from the complete install from the same package of 5.015-nt-max via TCP I fixed a bit doing in ths way: MYSQL conn; mysql_init(&conn); MYSQL * connPtr = mysql_real_connect(&conn,NULL,"root","root","test",0,NULL,0); if (connPtr== NULL) { fprintf(stderr, "Failed to connect to database: Error: %s\n", mysql_error(&conn)); getch(); return 1; } USING a local struct instead of a pointer to strucnt ( allocated by the library..) i got a correct result..... (by the way mysql Admin incoretly reports I am using win2003 server instead of XP PRO 64) (see attach)
[27 Nov 2005 14:48]
Valeriy Kravchuk
The solution you found is a clearly documented way to use mysql_real_connect (http://dev.mysql.com/doc/refman/5.0/en/mysql-real-connect.html): "The first parameter should be the address of an existing MYSQL structure. Before calling mysql_real_connect() you must call mysql_init() to initialize the MYSQL structure. You can change a lot of connect options with the mysql_options() call. See Section 22.2.3.48, “mysql_options()”." As for a problem with MySQL Adminstrator showing incorrect Windows version, you may open a separate bug report, if you want.