zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    Sublime Text 3 格式化HTML CSS JS 代码
    CSS 温故而知新
    JQuery Mobile 学习笔记
    Eclipse ADT 代码注释模版
    Eclipse ADT 与VS 常用的快捷键 对比学习
    元组、文件、以及其他
    类型与运算
    python
    python 内置函数 lamda表达式。 open 文件方法
    python 基础 基本数据类型
  • 原文地址:https://www.cnblogs.com/lwmp/p/6255360.html
Copyright © 2011-2022 走看看