使用postges用户进行初始化,但是报权限不够
bash-3.2$ ./initdb -D /var/lib/data/
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale "zh_CN.UTF-8".
The default database encoding has accordingly been set to "UTF8".
initdb: could not find suitable text search configuration for locale "zh_CN.UTF-8"
The default text search configuration will be set to "simple".
creating directory /var/lib/data ... initdb: could not create directory "/var/lib/data": 权限不够
将/var/lib/pgsql的拥有者该为postgres,再执行
[root@db1 lib]# chown postgres /var/lib/pgsql/
bash-3.2$ pwd
/var/lib/pgsql/bin
bash-3.2$ ./initdb -D /var/lib/pgsql/data/
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale "zh_CN.UTF-8".
The default database encoding has accordingly been set to "UTF8".
initdb: could not find suitable text search configuration for locale "zh_CN.UTF-8"
The default text search configuration will be set to "simple".
creating directory /var/lib/pgsql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 32MB
creating configuration files ... ok
creating template1 database in /var/lib/pgsql/data/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating collations ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
loading PL/pgSQL server-side language ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok
WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.
Success. You can now start the database server using:
./postgres -D /var/lib/pgsql/data
or
./pg_ctl -D /var/lib/pgsql/data -l logfile start
2.4.8 进入数据库
bash-3.2$ ./psql
Password:
psql.bin (9.2.21)
Type "help" for help.
No entry for terminal type "xterm";
using dumb terminal settings.
postgres=#