欢迎投稿

今日深度:

postgresql,

postgresql,


登陆: window: psql -U name linux: psql -U name -h IP

向PostgreSql数据库中导入.sql文件: psql -U username -W -d dbname -f xx.sql

删除有外键关系的表:drop table tablename cascade;

修改自增长起始数据:alter sequence sequence_name restart with 100;

---------------------------------------PostgresSQL数据库在ubuntu上的安装步骤------------------------------

----------------------------------------------------------------------------------------------------------

1.apt-get update 更新源,否则有可能会发生url not found 的现象

2.sudo apt-get install postgresql 安装数据库,我们的版本是PostgreSQL-9.3

3.安装完后会有PostgreSQL的客户端psql,通过 sudo -u postgres psql 进入,提示符变成: postgres=#

4.修改密码:alter user postgres with password '123456'; 5.导入创建数据库和创建表格的脚本

# 6,7,8 的作用是配置数据库以允许远程连接访问(用于测试,实际项目可忽略)

# 6.修改监听地址:sudo gedit /etc/postgresql/9.5/main/postgresql.conf 将 #listen_addresses = 'localhost' 的注释去掉并改为 listen_addresses = '*'

#7.修改可访问用户的IP段:sudo gedit /etc/postgresql/9.5/main/pg_hba.conf 在文件末尾添加: host all all 0.0.0.0 0.0.0.0 md5 ,表示运行任何IP连接

#8.重启数据库:sudo /etc/init.d/postgresql restart

#登陆 peer connection : sudo -u postgres psql

        password connection :psql -U postgres -h localhost

---------------------------------------------------------------------------------------------------------

参考1

参考2

www.htsjk.Com true http://www.htsjk.com/postgresSQL/27133.html NewsArticle postgresql, 登陆: window: psql -U name linux: psql -U name -h IP 向PostgreSql数据库中导入.sql文件: psql -U username -W -d dbname -f xx.sql 删除有外键关系的表:drop table tablename cascade; 修改自增长起始数据:...
相关文章
    暂无相关文章
评论暂时关闭