Bug #54625 | Unable to connect using latest C connector | ||
---|---|---|---|
Submitted: | 18 Jun 2010 23:15 | Modified: | 26 May 2012 19:46 |
Reporter: | Marco Hest | Email Updates: | |
Status: | No Feedback | Impact on me: | |
Category: | Connector / C | Severity: | S2 (Serious) |
Version: | 6.0.2 | OS: | Any (Windows 7) |
Assigned to: | CPU Architecture: | Any |
[18 Jun 2010 23:15]
Marco Hest
[21 Jun 2010 6:13]
Sveta Smirnova
Thank you for the report. Please send us command you use when connect to MySQL server via command line client.
[21 Jun 2010 12:40]
Marco Hest
I'm not sure what exactly you mean since I hardly ever use the command line client, but here: c:\xampp\mysql\bin>mysql.exe -u root -p Enter password: ****** Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 31 Server version: 5.1.41 Source distribution Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
[23 Jun 2010 8:47]
Sveta Smirnova
Thank you for the feedback. I need to be sure you can connect to MySQL server using option specified. For example, I can connect to server on my machine using program linked with Connector/C and valid connect options. In the code example you wrote: > mysql_options(&mysql,MYSQL_READ_DEFAULT_GROUP,"sometestapp"); > if (!mysql_real_connect(&mysql,"localhost","testuser","testpw","testdb",0,NULL,0)) While with command line client you connect as user root. Please try command line client with options like in C program and inform us about results.
[23 Jun 2010 11:49]
Marco Hest
The code I used was taken from the API reference, I also tried connecting without the mysql_options line which didn't work either. The problem exists on both my windows 7 Ultimate x64 systems, but I'm not sure if this is related. I'm compiling using Visual Studio 2008 Professional and linking against the official binaries.
[23 Jun 2010 19:37]
Sveta Smirnova
Thank you for the feedback. What command mysql.exe -h localhost -u testuser -ptestpw testdb outputs? Also I see mysql_library_init call. Are you compiling embedded server?
[24 Jun 2010 11:47]
Marco Hest
No, I only want to compile a mysql client, not the server. I saw that library_init call in some other examples so I tried it out, but it makes no difference when leaving it out. C:\xampp\mysql\bin>mysql -h localhost -u testuser -p testpw testdb Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 49 Server version: 5.1.41 Source distribution Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql>
[10 Jan 2011 8:13]
Say Tan
I have the same problem. I compiled a sample C program to communicate with the localhost (running mysqld ) on ubuntu 10.10 ------------- Code starts here! ---------------------- /* client1.c - connect to and disconnect from MySQL server */ #include <my_global.h> #include <mysql.h> static char *opt_host_name = "localhost"; /* server host (default=localhost) */ static char *opt_user_name = "admin"; /* username (default=login name) */ static char *opt_password = "password"; /* password (default=none) */ static unsigned int opt_port_num = 0; /* port number (use built-in value) */ static char *opt_socket_name = NULL; /* socket name (use built-in value) */ static char *opt_db_name = NULL; /* database name (default=none) */ static unsigned int opt_flags = 0; /* connection flags (none) */ static MYSQL *conn; /* pointer to connection handler */ int main (int argc, char *argv[]) { /* initialize connection handler */ conn = mysql_init (NULL); if (conn == NULL) { printf("unable to create conn\n"); exit(1); } else { printf("created conn\n"); } /* connect to server */ if (!mysql_real_connect (conn, opt_host_name, opt_user_name, opt_password, opt_db_name, opt_port_num, opt_socket_name, opt_flags)) { printf("unable to connect to server\n"); exit(1); } /* disconnect from server */ mysql_close (conn); exit (0); } ------------- Code ends here! --------------------- Server information as follows: MySQL Version: MySQL 5.1.49-1ubuntu8 Network Name: localhost.localdomain IP: 127.0.0.1 I connected successfully to the MySQL server using MySQL Administrator (MySQL Client Version 5.1.49) ps - code was lifted from the Internet.
[26 Apr 2012 19:46]
Sveta Smirnova
Thank you for the feedback. I still can not repeat described behavior. All reporters: please provide full code you use, compile line and output of command. My example. I used code provided in last comment. Compiled it with: $ gcc bug54625.c -o bug54625 `/home/sveta/build/mysql-connector-c-6.0.2/bin/mysql_config --include --libs` And run: $ ./bug54625 created conn
[27 May 2012 1:00]
Bugs System
No feedback was provided for this bug for over a month, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to "Open".