1.正常安装,点开之后如果系统强行发出警告中断,中断警告有一些乱码,则是安装路径有中文,或者电脑命名有中文,改成英文就可以了
2.如果安装到最后,弹出提示有Problem running post-install step. Installation may not complete correctly. The database cluster initialisation failed.,则先不用管,继续完成安装。
3.打开CMD或者powershell(注意,两者运行命令会有不同),
先CD到安装目录:C:\Users\bsbof> cd D:\postgresql\13\bin
D:\postgresql\13\bin\路径是你的安装目录,根据实际需要更改。
输入
(CMD窗口)D:\postgresql\13\bin>psql -U postgres
(powershell窗口)D:\postgresql\13\bin> .\psql -U postgres
A.如果正常运行,则没有问题
B.如果显示psql: 错误: 致命错误: 角色 "postgres" 不存在,则往下操作
4.创建数据库
(CMD窗口)D:\postgresql\13\bin> createuser -s -r postgres
(powershell窗口)D:\postgresql\13\bin> .\createuser -s -r postgres
一般没有弹出消息,则已经创建成功了。如果还有异常,可能是postgresql的服务没有打开,点击左下角windows,搜索“服务”,找到postgres -13并启动。
5.连接postgressql
(CMD窗口)D:\postgresql\13\bin>psql -U postgres
(powershell窗口)D:\postgresql\13\bin> .\psql -U postgres
命令提示符窗口会出现postgres=#,意味着连接成功了
6.测试执行sql语句
postgres=# SELECT 1;
按下回车键
出现以下信息,则说明执行成功了。
2.如果安装到最后,弹出提示有Problem running post-install step. Installation may not complete correctly. The database cluster initialisation failed.,则先不用管,继续完成安装。
3.打开CMD或者powershell(注意,两者运行命令会有不同),
先CD到安装目录:C:\Users\bsbof> cd D:\postgresql\13\bin
D:\postgresql\13\bin\路径是你的安装目录,根据实际需要更改。
输入
(CMD窗口)D:\postgresql\13\bin>psql -U postgres
(powershell窗口)D:\postgresql\13\bin> .\psql -U postgres
A.如果正常运行,则没有问题
B.如果显示psql: 错误: 致命错误: 角色 "postgres" 不存在,则往下操作
4.创建数据库
(CMD窗口)D:\postgresql\13\bin> createuser -s -r postgres
(powershell窗口)D:\postgresql\13\bin> .\createuser -s -r postgres
一般没有弹出消息,则已经创建成功了。如果还有异常,可能是postgresql的服务没有打开,点击左下角windows,搜索“服务”,找到postgres -13并启动。
5.连接postgressql
(CMD窗口)D:\postgresql\13\bin>psql -U postgres
(powershell窗口)D:\postgresql\13\bin> .\psql -U postgres
命令提示符窗口会出现postgres=#,意味着连接成功了
6.测试执行sql语句
postgres=# SELECT 1;
按下回车键
出现以下信息,则说明执行成功了。