Postgresql.zip版,config.bat
@echo off
echo 添加windows用户[postgres]
net user /add /y postgrespassword /EXPIRES:NEVER /COMMENT:"Postgresql Service Account"
echo [配置postgresql环境变量]
reg add "HKCU/Environment" /v PG_Home /t reg_sz /d "J:/pgsql" /f
reg add "HKCU/Environment" /v PG_Data /t reg_sz /d "J:/pgsql/data" /f
reg add "HKCU/Environment" /v PG_lib /t reg_sz /d "J:/pgsql/lib" /f
reg add "HKCU/Environment" /v PG_Host /t reg_sz /d "localhost" /f
reg add "HKCU/Environment" /v Path /t reg_sz /d """"%%Java_Home%%/bin""";"""%%Tomcat_Home%%/bin""";"""%%PG_Home%%/bin""";" /f
echo [配置postgresql data]
j:/pgsql/bin/initdb -D j:/pgsql/data -U postgres --encoding=UTF-8 --locale=C
echo [启动postgresql服务]
j:/pgsql/bin/pg_ctl -D "j:/pgsql/data" -l logfile start
echo [创建角色、数据库、导入数据...]J:/pgsql/bin/psql -U postgres -w -c "CREATE USER mvp WITH CREATEDB CREATEUSER PASSWORD 'mvp3'"J:/pgsql/bin/psql -U mvp -d postgres -w -c "CREATE DATABASEmvp_center with owner = mvp"J:/pgsql/bin/createlang -U mvp -w plpgsql mvp_centerJ:/pgsql/bin/psql -U mvp -w -d mvp_center -f index.sql
原文链接:https://www.f2er.com/postgresql/197009.html