Thanks for your help. I understand now.
@abk also answers this question, and I will copy it here for anyone interested:
- On the server-side: Each mechanism for launching Neo4j is only aware of itself. There is no global state through which the DBMSes can check with each other.
- On the client-side: cypher-shell makes assumptions about the default hostname and port for a neo4j database. It will connect to whatever DBMS server is running at the hostname and port, regardless of how that server was launched.
- Neo4j Desktop attempts to manage port conflicts. It monitors a DBMS when you click "start" to ensure that it is running, and to look for port conflicts as one reason the DBMS may fail to start. When that is a problem Desktop will offer to start Neo4j on a different port by rewriting the neo4j.conf file. You can see this behavior by first starting a DBMS manually from the command line, and then starting a DBMS from within Desktop.
Conversely, a manually started Neo4j DBMS will only use the ports that are specified within the neo4j.conf file. Neo4j DBMS itself will realize there is a port conflict but will not attempt to change ports. It only uses the port specified. The result is that a port conflict will prevent Neo4j DBMS from starting.