Possible to use libmysqlclient-dev.lib functions (native c client) with mySQL Router?

Posted on

Question :

I’ve setup the mysql innodb cluster with some difficulty, and have mysqlrouter running and listening on ports with the correct IP address. I then have a C program trying to connect to mysqlrouter to submit queries to, but the function, mysql_connect() gives me an error: “No such file or directory”.

It’s likely it was looking for a mysqld-specific file. Has anyone managed to setup communications between a C program and mysqlrouter?

Edit: Fixed, have to setup permissions for the IP address mysqlrouter is on
https://dev.mysql.com/doc/mysql-router/8.0/en/mysql-router-general-using-developing.html

Answer :

The immediate answer, without more information, is that you are trying accessing MySQL (the protocol, not the server), using unix socket/named pipes, which is the only reason I can think from the top of my mind why a mysql connector may want to open a file. Check your connection options and make sure you are connecting using TCP, with a host, port combination.

It could be something else, but it is what I would try debugging first, for other issues we would need more context and code.

Fixed, I have to setup permissions for the IP address mysqlrouter is on.

On the sql node, do the following:

mysql> GRANT PRIVILEGES ON . TO account@ IDENTIFIED BY ‘password’;

mysql> FLUSH PRIVILEGES;

Reference:
https://dev.mysql.com/doc/mysql-router/8.0/en/mysql-router-general-using-developing.html

Leave a Reply

Your email address will not be published. Required fields are marked *