Article DetailsDetailsHelp DetailsIn Neo4j server, APOC optionally allows you to run cypher commands after database initialization is finished. This can be used to set some dynamic settings or run some database operations. In Neo4j 5, the initializers are defined by Configuration Options using the following naming convention: apoc.initializer.<database_name>.<identifier> = <some cypher string> For each database, all initializer strings are ordered by <identifier> and each of them is executed in a separate transaction. If you only have one single initializer for a given database you can omit <identifier>. We can set some dynamic settings using this method and create an user at the same time.For example: We want to enable parallel runtime support when the database starts and we also want to create an user "dummy" and set its password. We can add the following settings in conf/apoc.conf: apoc.initializer.system.0=create user dummy set password 'abcd1234' apoc.initializer.system.1=call dbms.setConfigValue('internal.cypher.parallel_runtime_support','ALL') Once the Neo4j server has started, we would see the following logs in debug.log 2023-11-20 09:33:18.829+0000 INFO [o.n.c.Config] internal.cypher.parallel_runtime_support changed to ALL, by dbms.setConfigValue 2023-11-20 09:33:18.839+0000 INFO [a.c.CypherInitializer] [system/00000000] successfully initialized: CALL dbms.setConfigValue("internal.cypher.parallel_runtime_support", "ALL") 2023-11-20 09:33:19.263+0000 INFO [a.c.CypherInitializer] [system/00000000] successfully initialized: CREATE USER dummy SET PASSWORD '******' CHANGE REQUIRED Another example is that we want to create an index for :Person in default db neo4j add two person nodes in default db neo4j This is achieved by adding the settings in apoc.conf as below: apoc.initializer.neo4j.0=create index person_index for (p:Person) on (p.name) apoc.initializer.neo4j.1=create (:Person{name:'foo'}) apoc.initializer.neo4j.2=create (:Person{name:'bar'}) References: https://neo4j.com/docs/apoc/current/operational/init-script/ https://neo4j.com/docs/apoc/current/config/ InformationTitleHow to run cypher commands after database initialization is finished in Neo4j 5Article Created Date3/15/2024, 10:54 PMURL Name23052967793171-How-to-run-cypher-commands-after-database-initialization-is-finished-in-Neo4j-5Last Modified Date5/7/2026, 9:44 AM