Install POSTGRESQL on FREEBSD, freebsdpostgresql

Source: Internet
Author: User
Tags postgres database

Install POSTGRESQL on FREEBSD, freebsdpostgresql

It took a long time to reinitialize it many times.

During installation, run the command pkg search postgresql. Select the latest 9.4 to install the server, and the client will be installed together. There will be a lot of text prompts after installation, this is very useful. After installation, a user pgsql is created. The home directory is/usr/local/pgsql.

Step 1

Switch to the pgsql user first, su root, su pgsql. Then, create the data folder in the pgsql home directory. The root user is not allowed.
Initialization: initdb-D/usr/local/pgsql/data/generates many files. When the database storage area is initialized, an postgres database is automatically created to store messy settings and third-party plug-in data. There will also be a template template1. It is not clear here that this template will be used to create databases in the future. Here we are talking about the problem of database encoding. Here, the tragedy has been initialized many times.
By default, after the above command is executed, the prompt text will be told to you (I didn't see it at the time ..) The default database encoding is "SQL _ascii", and the default text search is set to english .. When I rely on the execution, I am stuck on the screen and wait until the execution is complete... The re-initialization method is also shown in the prompt. Direct initdb prompts you to clear the original folder or create a new one. Rm-rf *. initdb-help
-Encoding, initdb-encoding = UTF8-D/usr/local/pgsql/data/

Start postgresql and start the script/usr/local/etc/rc. d/postgresql. You are prompted to add it to the/etc/rc. conf file.
Status not running, start successful

Create Database, createdb-encoding = UTF-8 bt, use client connection, qsql bt,
Show server_encoding; check the server encoding and utf8
\ Encoding: view the client encoding. The client is also SQL _ASCII. You can use/encoding utf8 to change the client encoding.
You can also directly use \ l for viewing.

OK.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.