# Create new database using neo4j-admin or cypher-shell

**URL:** <https://community.neo4j.com/t/create-new-database-using-neo4j-admin-or-cypher-shell/71445>\
**Category:** Cypher\
**Created:** [November 14, 2024, 11:26pm UTC](https://community.neo4j.com/t/create-new-database-using-neo4j-admin-or-cypher-shell/71445 "2024-11-14T23:26:21Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![RikkiGraf](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/rikkigraf/32/33050_2.png) [@RikkiGraf](https://community.neo4j.com/u/RikkiGraf)\
**Post date:** [November 14, 2024, 11:26pm UTC](https://community.neo4j.com/t/create-new-database-using-neo4j-admin-or-cypher-shell/71445/1 "2024-11-14T23:26:21Z")

</div>

Hi  
I do not have access to the neo4j UI console due to ports mis-configurations in kubernetes, however I am able to import files and load files from a nodes and relationships files in a db called userdb. I can also see the folder in databases dir.

However to use this when i try to use cypher-shell for creating the database it does not seem to work.  
With `cypher-shell "Create dababase userdb"` resulting in  
Upsupported administration command: create database userdb

I have searched and neo4j-admin also does not have the create command.  
I would appreciate any help.  
Thanks in advance  
Thanks

---

<div class="post-metadata">

**Author:** ![dana\_canzano](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/dana_canzano/32/27392_2.png) [@dana\_canzano](https://community.neo4j.com/u/dana_canzano)\
**Post date:** [November 15, 2024, 2:23am UTC](https://community.neo4j.com/t/create-new-database-using-neo4j-admin-or-cypher-shell/71445/2 "2024-11-15T02:23:13Z")

</div>

@RikkiGraf

what version of Neo4j?  
Are you using Community Edition? which only supports 1 database.

> **[Introduction - Operations Manual](https://neo4j.com/docs/operations-manual/current/introduction/#_neo4j_editions)**
>
> Introduction to Neo4j, ACID-compliant, property graph, community edition, enterprise edition, Neo4j Aura.

---

<div class="post-metadata">

**Author:** ![RikkiGraf](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/rikkigraf/32/33050_2.png) [@RikkiGraf](https://community.neo4j.com/u/RikkiGraf)\
**Post date:** [November 15, 2024, 2:59pm UTC](https://community.neo4j.com/t/create-new-database-using-neo4j-admin-or-cypher-shell/71445/3 "2024-11-15T14:59:29Z")

</div>

Enterprise version  
5.19.0

---

<div class="post-metadata">

**Author:** ![dana\_canzano](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/dana_canzano/32/27392_2.png) [@dana\_canzano](https://community.neo4j.com/u/dana_canzano)\
**Post date:** [November 15, 2024, 3:12pm UTC](https://community.neo4j.com/t/create-new-database-using-neo4j-admin-or-cypher-shell/71445/4 "2024-11-15T15:12:45Z")

</div>

@RikkiGraf

at time of error anything logged in logs\debug.log?

---

<div class="post-metadata">

**Author:** ![RikkiGraf](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/rikkigraf/32/33050_2.png) [@RikkiGraf](https://community.neo4j.com/u/RikkiGraf)\
**Post date:** [November 15, 2024, 3:55pm UTC](https://community.neo4j.com/t/create-new-database-using-neo4j-admin-or-cypher-shell/71445/5 "2024-11-15T15:55:48Z")

</div>

Not seeing anything in the debug.log file. just ran the command again and same error!!

---

<div class="post-metadata">

**Author:** ![john.stegeman](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/john.stegeman/32/26277_2.png) [@john.stegeman](https://community.neo4j.com/u/john.stegeman)\
**Post date:** [November 15, 2024, 4:12pm UTC](https://community.neo4j.com/t/create-new-database-using-neo4j-admin-or-cypher-shell/71445/6 "2024-11-15T16:12:25Z")

</div>

Just for completeness' sake - what do you get when you run:

```auto
call dbms.components() yield name, versions, edition unwind versions as version return name, version, edition;

```

---

<div class="post-metadata">

**Author:** ![ameyasoft](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/ameyasoft/32/32639_2.png) [@ameyasoft](https://community.neo4j.com/u/ameyasoft)\
**Post date:** [November 15, 2024, 9:45pm UTC](https://community.neo4j.com/t/create-new-database-using-neo4j-admin-or-cypher-shell/71445/7 "2024-11-15T21:45:21Z")

</div>

Open your Neo4j browser and click on the database icon at top left. When clicked you will see a dropdown list of databases. In your case you will see 'neo4j' and 'system'. select 'system' . Run the query "SHOW DATABASES". This will show all the databases . Execute the Cypher query: CREATE DATABASE userdb. Once successful, rerun the SHOW DATABASES and now you should see you db name. Also check to see if the db is active. Now in the left db dropdown select your db.

---

<div class="post-metadata">

**Author:** ![RikkiGraf](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/rikkigraf/32/33050_2.png) [@RikkiGraf](https://community.neo4j.com/u/RikkiGraf)\
**Post date:** [November 18, 2024, 3:01pm UTC](https://community.neo4j.com/t/create-new-database-using-neo4j-admin-or-cypher-shell/71445/8 "2024-11-18T15:01:10Z")

</div>

Thanks , but as I mentioned I dont have access to the UI. so using the cypher-shell and neo4j-admin.

---

<div class="post-metadata">

**Author:** ![RikkiGraf](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/rikkigraf/32/33050_2.png) [@RikkiGraf](https://community.neo4j.com/u/RikkiGraf)\
**Post date:** [November 18, 2024, 3:03pm UTC](https://community.neo4j.com/t/create-new-database-using-neo4j-admin-or-cypher-shell/71445/9 "2024-11-18T15:03:46Z")

</div>

ok turns out it is "Neo4j Kernel" | 5.23.0" | "community" , the IT ended up doing a community installation.  
So now my question is

- how do i use the only database "neo4j" in community edition to load/import nodes.csv and edges.csv using the cypher-shell/neo4j-admin tool ?  
Thanks

---

<div class="post-metadata">

**Author:** ![john.stegeman](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/john.stegeman/32/26277_2.png) [@john.stegeman](https://community.neo4j.com/u/john.stegeman)\
**Post date:** [November 18, 2024, 4:32pm UTC](https://community.neo4j.com/t/create-new-database-using-neo4j-admin-or-cypher-shell/71445/10 "2024-11-18T16:32:59Z")

</div>

Have you tried [LOAD CSV - Cypher Manual](https://neo4j.com/docs/cypher-manual/current/clauses/load-csv/)

---

<div class="post-metadata">

**Author:** ![RikkiGraf](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/rikkigraf/32/33050_2.png) [@RikkiGraf](https://community.neo4j.com/u/RikkiGraf)\
**Post date:** [November 18, 2024, 7:15pm UTC](https://community.neo4j.com/t/create-new-database-using-neo4j-admin-or-cypher-shell/71445/11 "2024-11-18T19:15:26Z")

</div>

./bin/neo4j-admin database import full neo4j —nodes=/import/nodes.csv —relationships=/import/edges.csv —trim-strings=true

This is the command that I have to load into the neo4j pods, but when I tried to execute it in the neo4j (which is running in kubernetes pods) it asked me to shut down the server. When I did that it kicked me out of the pods, wondering now where should I run the neo4j-admin command

If I were to use LOAD CSV which I have used in the past but requires me to understand the schema and appropriately add them into my LOAD CSV where I want to make connections etc.

However in this case this is an external dataset and please suggest how I go about loading it.

Thanks

---

<div class="post-metadata">

**Author:** ![john.stegeman](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/john.stegeman/32/26277_2.png) [@john.stegeman](https://community.neo4j.com/u/john.stegeman)\
**Post date:** [November 18, 2024, 9:31pm UTC](https://community.neo4j.com/t/create-new-database-using-neo4j-admin-or-cypher-shell/71445/12 "2024-11-18T21:31:37Z")

</div>

There is an offline maintenance mode provided for this purpose:

> <https://github.com/neo4j/helm-charts/blob/3f2e1976b64008e6ecfa9f79ee2d03aeb36b8be8/neo4j/values.yaml#L58-L59>

From one of my colleagues:

You can run a helm-upgrade to put the pod in maintenance mode:

helm upgrade neo4j --set neo4j.offlineMaintenanceModeEnabled=true

Once applied, the pod will restart but Neo4j won't be running. Instead, it will run a dummy process that outputs a message indicating it's in maintenance mode.  
Then you can exec into the pod and perform your offline import.

---

<div class="post-metadata">

**Author:** ![RikkiGraf](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/rikkigraf/32/33050_2.png) [@RikkiGraf](https://community.neo4j.com/u/RikkiGraf)\
**Post date:** [November 21, 2024, 7:42pm UTC](https://community.neo4j.com/t/create-new-database-using-neo4j-admin-or-cypher-shell/71445/13 "2024-11-21T19:42:36Z")

</div>

This is what I have ended up using for loading the nodes:

LOAD CSV WITH HEADERS FROM "file:///nodes\_load.csv" AS row  
CALL apoc.create.node([row.LABEL],{node\_id:row.node\_id, node\_index:row.node\_index})  
yield node  
return count(\*)

And it was quick,  
However when loading the relationships which are about 5M:

CALL apoc.periodic.iterate(  
'CALL apoc.load.csv("file:///edges\_small.csv") yield map AS row return row',  
'MATCH (n{node\_index:row.START\_ID}), (m{node\_index:row.END\_ID})  
CALL apoc.create.relationship(n, row.TYPE, {relation:row.disrelation},m)  
yield rel return rel',  
{batchSize:50000, parallel:true})

It has been very slow , has been going on for several hours and only 400k relations are loaded.  
Any pointers for speeding it up?

---

<div class="post-metadata">

**Author:** ![john.stegeman](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/john.stegeman/32/26277_2.png) [@john.stegeman](https://community.neo4j.com/u/john.stegeman)\
**Post date:** [November 21, 2024, 8:00pm UTC](https://community.neo4j.com/t/create-new-database-using-neo4j-admin-or-cypher-shell/71445/14 "2024-11-21T20:00:31Z")

</div>

Do you have indexes on START\_ID and END\_ID? Not having those (indexes to enable you to find the relationship ends quickly) is almost always the cause of poor performance loading relationships.

---

<div class="post-metadata">

**Author:** ![RikkiGraf](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/rikkigraf/32/33050_2.png) [@RikkiGraf](https://community.neo4j.com/u/RikkiGraf)\
**Post date:** [November 21, 2024, 8:47pm UTC](https://community.neo4j.com/t/create-new-database-using-neo4j-admin-or-cypher-shell/71445/15 "2024-11-21T20:47:56Z")

</div>

I have 5 different types of nodes with node\_index property and I have constraint set on all 5 of those nodes:node\_index!!

---

<div class="post-metadata">

**Author:** ![dana\_canzano](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/dana_canzano/32/27392_2.png) [@dana\_canzano](https://community.neo4j.com/u/dana_canzano)\
**Post date:** [November 21, 2024, 9:43pm UTC](https://community.neo4j.com/t/create-new-database-using-neo4j-admin-or-cypher-shell/71445/16 "2024-11-21T21:43:02Z")

</div>

Can you please return the output of cypher

```auto
show indexes;

```

Not that I'm suggesting apoc is the cause of your performance issue but why complicate matters with apoc when this could have been without the need for apoc and as described at

> **[LOAD CSV - Cypher Manual](https://neo4j.com/docs/cypher-manual/current/clauses/load-csv/#_handle_large_amounts_of_data)**
>
> \`LOAD CSV\` is used to import data from CSV files into a Neo4j database.

---

<div class="post-metadata">

**Author:** ![RikkiGraf](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/rikkigraf/32/33050_2.png) [@RikkiGraf](https://community.neo4j.com/u/RikkiGraf)\
**Post date:** [December 3, 2024, 8:09pm UTC](https://community.neo4j.com/t/create-new-database-using-neo4j-admin-or-cypher-shell/71445/17 "2024-12-03T20:09:10Z")

</div>

I had the constraints set on all the source and target properties, so assuming that would create the indexes as well.  
I let the script run over the weekend and it took about 36 hours for 130k nodes and 4.5M relationships.  
Thanks for all the help

---

<div class="post-metadata">

**Author:** ![john.stegeman](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/john.stegeman/32/26277_2.png) [@john.stegeman](https://community.neo4j.com/u/john.stegeman)\
**Post date:** [December 3, 2024, 9:51pm UTC](https://community.neo4j.com/t/create-new-database-using-neo4j-admin-or-cypher-shell/71445/18 "2024-12-03T21:51:59Z")

</div>

It is [documented](https://neo4j.com/docs/cypher-manual/current/constraints/managing-constraints/#create-key-constraints) that creating property uniqueness or key constraints will create indexes as well. Having said that, it still seems pretty slow - did you try using LOAD CSV directly, without involving apoc?
