-
Notifications
You must be signed in to change notification settings - Fork 40
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 protocol = "tcp" as argument to dbConnect() #180
Comments
Thanks. Does it work if you set I wonder if we should switch to TCP when a |
In that case, I get this error: The directory actually would exist and contains the file |
Can you connect to the MariaDB server from your host with the |
It's a MySQL server to which I connect with the arguments mentioned above (see "situation"). I read that the support of the R package RMySQL is not guaranteed anymore (didn't verify that though!) which is why I use RMariaDB to connect. I would like to mention that the connection can be established using the config file, it's just not very handy and would be much more convenient to specify the protocol as argument and updating the manual respectively. |
I'm looking for ways to avoid adding an extra argument. Can you connect with |
No, this results in:
Whereas in contrast specifying the protocol argument everything runs smoothly:
|
What about |
This works:
But analogously specifying the host in R doesn't:
|
Does your first R code need |
My fault! Sry...
Specifying host and port establishes successfully the connection. I wonder why the default host argument, which is
|
The behavior is documented in I agree that your second example should switch to TCP/IP because you have specified a port. On the other hand, perhaps we really should follow the Would you like to contribute a pull request? |
I'll do but it will take some time. |
We need to call |
Situation
I host a mysql DB in a local docker container.
docker-compose.yml
I expose the port 6603 to the localhost which allows me to access mysql in the container by i.e.:
mysql --host=localhost --port=6603 --user=root --password=secret --protocol=tcp
Problem
When I try to connect my local R Studio (not in docker) to mysqlDB via the open port with
I get the error:
Error: Failed to connect: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
. The same error happens when I specifyhost = "localhost"
explicitly.Which is unexpected, as I don't want to connect to the socket file rather using the TCP network protocol.
Unfortunately the argument
protocol = "TCP"
is not supported.Workaround
I could solve the issue with specifying the protocol in the configuration file:
.my.cnf
and then in R specifying the path to the configuration file and groups argument.
Proposed Solution
In regard of the raising popularity of container stacks, it would be very valuable to have an argument in the method
dbConnect()
to directly specify the protocol type. Then, the workaround with the config file would be obsolete.I imagine sth like this
The text was updated successfully, but these errors were encountered: