其实官方文档上写的明白:
1、停止Neo4j服务:
$ bin/neo4j stop
2、配置文件neo4j.conf中禁用dbms.security.auth_enabled这个参数(打开注释即可)
dbms.security.auth_enabled=false
3、启动Neo4j
bin/neo4j start
4、两种方式,一是在Neo4j命令行终端,一是在浏览器终端
$ bin/cypher-shell -d system
neo4j@system> ALTER USER neo4j SET PASSWORD 'mynewpass';
neo4j@system> :exit
浏览器的话,在system数据库中(:use system)执行下面命令
ALTER USER neo4j SET PASSWORD 'mynewpass';
5、停止Neo4j
bin/neo4j stop
6、把配置文件中的修改改回去,或者参数值改成true
#dbms.security.auth_enabled=false
或者
dbms.security.auth_enabled=true
7、重启Neo4j
bin/neo4j start
官方文档:https://neo4j.com/docs/operations-manual/current/configuration/password-and-user-recovery/