No, a connection string works like this: mysql://user:[email protected]_IP/DB_NAME
SERVER_IP = IP or hostname of the MySQL server. Within the overlay network you can easily use the service name, which is simply “db”, see docker-compose.yml.
Unfortunately I can’t remember if I created the initial user/database manually.
The documentation states:
After installing the dependencies, it is required to create the database manually. During the startup, Home Assistant will look for the database specified in the db_url. If the database doesn’t exist, it will not automatically create it for you.
Once Home Assistant finds the database, with right level of permissions, all the required tables will then be automatically created and the data will be populated accordingly.
So, you need a MySQL client to create the user and database. I use Sequel Pro (Mac client), but you could use Adminer from the community catalog. Adminer doesn’t seem to have a port mapping by default. After launching Adminer hit upgrade and add a port mapping so you can reach Adminer.
Also remember that Adminer will run in a separate stack and thus a separate overlay network. Connecting to the database within the Home Assistant stack is done via the host, and not “db” as stated above.