1

I have tried to connect to mysql server from C code.

#include <mysql.h>
#include <stdio.h>
#include <stdlib.h>
main(){
    MYSQL *conn;
    MYSQL_RES *res;
    MYSQL_ROW row;

    char *server = "localhost";
    char *user = "root";
    char *password = "12345"; /* set me first */
    char *database = "mydatabase";

    conn = mysql_init(NULL);
    printf("done 1\n");
    if (!mysql_real_connect(conn, server,
         user, password, database, 3306, "/tmp/mysql.sock", 0)) {
      fprintf(stderr, "%s\n", mysql_error(conn));
      exit(1);
   }
    printf("done 2\n");
   if (mysql_query(conn, "show tables")) {
      fprintf(stderr, "%s\n", mysql_error(conn));
      exit(1);
   }
    printf("done 3\n");
   res = mysql_use_result(conn);
    printf("done 4\n");
    printf("MySQL Tables in mysql database:\n");
    while ((row = mysql_fetch_row(res)) != NULL)
    printf("%s \n", row[0]);
    printf("done 5\n");
    mysql_free_result(res);
    mysql_close(conn);
}

But I have this weird problem:

done 1
Plugin caching_sha2_password could not be loaded: /usr//usr/lib/mysql/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory

I do not know why it tries to load lib from /usr//usr/

Please help if you have a deal with it already!

Rob
  • 14,746
  • 28
  • 47
  • 65
Mihail HRS
  • 115
  • 1
  • 1
  • 9
  • Possible duplicate of [Authentication plugin 'caching\_sha2\_password' cannot be loaded](https://stackoverflow.com/questions/49194719/authentication-plugin-caching-sha2-password-cannot-be-loaded) – Skanda Shastry Oct 12 '19 at 15:56
  • Not a duplicate, because the incorrect path `/usr//usr/...` is different. – Marcus Downing Feb 11 '20 at 15:53

0 Answers0