参考文章:
方法一:https://blog.csdn.net/qq_19330913/article/details/80468494
参考文章:
https://blog.csdn.net/sanbingyutuoniao123/article/details/52209653
https://www.cnblogs.com/cdyboke/p/6671284.html
sudo apt update出问题时考虑换一下源,修改/etc/apt/source.list文件,采用清华源或阿里源,或中科大源。
但如果不影响后续步骤,则可忽略。
方法二:https://blog.csdn.net/sweet_cm/article/details/83894863
1 官网https://www.postgresql.org/ --> download --> Linux --> other Linux -->tar.gz archive --> Linux x86-64(电脑64位)下载;
2 安装并初始化
tar -xvzf postgresql-10.1-1-linux-x64-binaries.tar.gz
# 解压出来之后目录为pgsql
mv pgsql /monchickey/
现在pgsql的安装目录就是/monchickey/pgsql
创建pgsql用户并设置密码:
useradd postgres
passwd postgres
# 两次输入密码并确认
注意:这里设置密码是linux用户postgres的登录密码,不是pgsql服务器的密码
创建pgsql数据目录: mkdir /monchickey/pgsql_data
给postgres用户授权目录访问权限:sudo chown postgres /monchickey/pgsql_data/
3 切换至postgres登录postgresql
sudo su - postgres 或 su - postgres
psql (-U postgres -h localhost)
登录成功!可以操作数据库了!
4 接下来就可以创建数据库,创建表了
这里推荐一个GUI工具:DBeaver,方便查看。
——————————————————————————————————————————————
微信关注号:python爬虫机器学习深度学习