http://localhost:7474/browser/ 登陆之后账号密码neo4j / neo4j 不对 页面出现以下:
一步重置密码并连接
停服务
/soft/neo4j-community-2025.09.0/bin/neo4j stop
设定初始密码(推荐自定义一个强密码,比如
Neo4!
)
/soft/neo4j-community-2025.09.0/bin/neo4j-admin dbms set-initial-password 'Neo5!'
如果返回 “password already set”,继续执行第 3 步“清 auth 文件”。
(仅当上一步报已设置时)清除旧认证文件后再设
仅影响用户认证信息,不影响图数据;适用于开发/测试环境。
rm -f /soft/neo4j-community-2025.09.0/data/dbms/auth /soft/neo4j-community-2025.09.0/bin/neo4j-admin dbms set-initial-password 'Neo45!'
启动服务
/soft/neo4j-community-2025.09.0/bin/neo4j start
浏览器连接
打开:
http://192.168.232.129:7474/browser/
Connect URL 里填:
bolt://192.168.232.129:7687
Username:
neo4j
Password:
Neo4j5!
(你刚设的)
看到 “Could not reach Neo4j” 时,先在 Windows PowerShell 测下端口通不通:
Test-NetConnection 192.168.232.129 -Port 7687
若不通,检查 VM 防火墙:
firewall-cmd --permanent --add-port=7687/tcp firewall-cmd --permanent --add-port=7474/tcp firewall-cmd --reload
连接项快速自检
neo4j.conf
里应有:server.default_listen_address=0.0.0.0 server.http.enabled=true server.http.listen_address=:7474 server.http.advertised_address=192.168.232.129:7474 server.bolt.enabled=true server.bolt.listen_address=:7687 server.bolt.advertised_address=192.168.232.129:7687 dbms.security.auth_enabled=true
端口监听:
ss -ltnp | grep -E '(:7474|:7687)'
按上面重置后,用 neo4j / 你新设的密码
登录就能进。
如果出现:
[root@localhost conf]# /soft/neo4j-community-2025.09.0/bin/neo4j-admin dbms set-initial-password 'Neo5!' Changed password for user 'neo4j'. IMPORTANT: this change will only take effect if performed before the database is started for the first time.
那条提示其实是 Neo4j 的标准输出:
Changed password for user 'neo4j'. IMPORTANT: this change will only take effect if performed before the database is started for the first time.
意思是「如果数据库已经启动过一次,这条命令不会生效」。
现在你可以按这个顺序把密码彻底改好并重新连上:
🔧 1. 停 Neo4j
/soft/neo4j-community-2025.09.0/bin/neo4j stop
🔧 2. 删除旧认证文件
这一步会清除旧的 neo4j 账户密码,仅限开发环境用。
rm -f /soft/neo4j-community-2025.09.0/data/dbms/auth
🔧 3. 重新设置初始密码
/soft/neo4j-community-2025.09.0/bin/neo4j-admin dbms set-initial-password 'Neo45!'
🔧 4. 启动数据库
/soft/neo4j-community-2025.09.0/bin/neo4j start
🔧 5. 浏览器连接
在宿主机打开
http://192.168.232.129:7474/browser/
然后在登录框里填:
Connect URL →
bolt://192.168.232.129:7687
Username →
neo4j
Password →
Neo45!
✅ 如果仍连不上 Bolt
确认端口已开放:
ss -ltnp | grep 7687
宿主机测试:
Test-NetConnection 192.168.232.129 -Port 7687
VM 内放行防火墙:
firewall-cmd --permanent --add-port=7687/tcp firewall-cmd --permanent --add-port=7474/tcp firewall-cmd --reload
控制台显示
[root@localhost conf]# /soft/neo4j-community-2025.09.0/bin/neo4j stop Neo4j is not running. [root@localhost conf]# rm -f /soft/neo4j-community-2025.09.0/data/dbms/auth [root@localhost conf]# /soft/neo4j-community-2025.09.0/bin/neo4j-admin dbms set-initial-password 'Neo45!' Changed password for user 'neo4j'. IMPORTANT: this change will only take effect if performed before the database is started for the first time.
很好,认证文件已清空并设置了新初始密码。现在按下面两步完成登录:
1) 启动并自检
/soft/neo4j-community-2025.09.0/bin/neo4j start ss -ltnp | grep -E '(:7474|:7687)' # 应看到 7474/7687 在 LISTEN tail -n 50 /soft/neo4j-community-2025.09.0/logs/neo4j.log
2) 通过 Browser 连接
在宿主机浏览器打开:
http://192.168.232.129:7474/browser/
在连接框里:
Connect URL:
bolt://192.168.232.129:7687
(不要用 neo4j://)Username:
neo4j
Password:
Neo4j5!
(你刚设置的)
若提示 “Could not reach Neo4j”,在宿主机跑:
Test-NetConnection 192.168.232.129 -Port 7687
(Windows)
在虚机上放行端口(如开启了 firewalld):
firewall-cmd --permanent --add-port=7474/tcp firewall-cmd --permanent --add-port=7687/tcp firewall-cmd --reload