Using Unix Sockets for Mariadb connection

I am currently using the recorder component to write data to a mariadb using the following:

mysql://homeassistant:[email protected]:3306/homeassistant?charset=utf8

I am currently running into some connection related error messages and wanted to see how I can optimize things. The recorder component page now reads:

“Unix Socket connections always bring performance advantages over TCP, if the database is on the same host as the recorder instance (i.e. localhost).”

I did a fair share of searching but cannot find how to accomplish this. Is there anyone who can help this mysql noob achieve this Unix Sockets connection?

Not sure if you have figured out what to do, but if not:

    db_url: mysql://username:password@localhost/hass?unix_socket=/run/mysqld/mysqld.sock

Basically, everything that works with SQLAlchemy should work with Home Assistant


Thanks, that works! Unfortunately I still get strange MySQL errors in the logs…