1,进入安装目录(要根据自己安装时的情况而定)
[root@localhost bin]# pwd
/opt/Postgresql/9.4/bin
[root@localhost bin]# ll *create*
-rwxr-xr-x 1 root daemon 54187 Dec 6 14:39 createdb
-rwxr-xr-x 1 root daemon 63879 Dec 6 14:39 createlang
-rwxr-xr-x 1 root daemon 56901 Dec 6 14:39 createuser
[root@localhost bin]#
[root@localhost bin]# ./createdb mydb
Password:
Password:
createdb: Could not connect to database template1: FATAL: password authentication Failed for user "root"
[root@localhost bin]#
-bash-3.2$ pwd
/opt/Postgresql/9.4/data
-bash-3.2$ ll pg_hba.conf
-rw------- 1 postgres postgres 4214 Dec 19 04:16 pg_hba.conf
-rwxr-xr-x 1 root root 3045 Dec 19 04:16 postgresql-9.4
-bash-3.2$ pwd
/etc/init.d
-bash-3.2$postgresql-9.4 reload
(重新加载配置 note:这里要切换到用户 postgres执行)
使用psql 命令进入创建的数据查看(如下)
$ psql mydb
If you do not supply the database name then it will default to your user account name. You already
In psql,you will be greeted with the following message:
psql (9.0.22)
Type "help" for help.
mydb=>
The last line Could also be:
mydb=#
hell=# select version();
version
------------------------------------------------------------------------------------------------------
--
Postgresql 9.4.5 on i686-pc-linux-gnu,compiled by gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-55),32-bi
t
(1 row)
hell=# select current_date;
date
------------
2015-12-19
(1 row)
hell=#
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。