Am 02.02.19 um 19:06 schrieb Mark Sapiro:
On 2/2/19 5:31 AM, Torge Riedel wrote:
A call to
mysql -umailman -p
successfully uses the socket on the machine and logs in.
Yet you haven't specified -S or --socket
I tried
mysql+pymysql://mailman:mailmanpass@127.0.0.1/mailman3?charset=utf8&use_unicode=1&unix_socket=/var/run/mysqld/mysqld.sock
as the connection string but it says that mysql server is not available. Which is the same if remove the "unix_socket" parameter. I have found this parameter when searching the net, but I'm not sure if it is supported.
I think it should be, but the actual connection is via the the sqlalchemy create_engine() function. It appears this should be passed to the pymysql Connection() function per <https://docs.sqlalchemy.org/en/rel_1_2/core/engines.html#custom-dbapi-args>
What happens if in a Python 3 session, you do
from pymysql import connect conn = connect('127.0.0.1', user='mailman', password='mailmanpass', database='mailman3', charset='utf8', use_unicode=1, unix_socket='/var/run/mysqld/mysqld.sock')
As I understand it, that's what sqlalchemy should be doing with your database url. In my testing, the above works with or without the unix_socket= argument, so I suspect something else is wrong in your case.
Hi,
thanks a lot for your answer. Yes, sounds valid that something else is (or was) wrong in my environment. I'm new to docker containers and might have overseen something.
I now managed it a different way: I used rinetd on the host to redirect connections from docker host ip of a bridged network to 127.0.0.1 to make MySQL accessible in the docker container.
This works and avoids mapping the mysqld.sock file into the container.
Thanks again Torge