Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for MySQL service file for connect() #121

Open
mileib opened this issue Apr 28, 2020 · 1 comment
Open

Add support for MySQL service file for connect() #121

mileib opened this issue Apr 28, 2020 · 1 comment

Comments

@mileib
Copy link

mileib commented Apr 28, 2020

Unlike the PostgreSQL interface (which works fine), the MySQL interface does not seem to support a services file as there is no call to mysql_options(conn, MYSQL_READ_DEFAULT_GROUP, servicename); anywhere in the current ls_mysql.c code.

If I have MYSQL_HOME set in the environment and issue a connect with "service=foobar" when I invoke luasql, the connection information in the my.cnf file located in MYSQL_HOME for connection foobar should be parsed and used.

That is the only thing I should have to specify on the connection string and all the other required options will be pulled from the file under the foobar connection settings.

If I try this with the current code, it doesn't work and I receive

"Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)"

If I hack up the connect function and use mysql_options() as described above, it works fine.

@tomasguisasola
Copy link
Contributor

Hi mileib

Could you share your code or add a pull request?

Regards,
Tomás

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants