2009年9月22日 星期二

Ubuntu 安裝 Postgres SQL 8.3

Install PostgreSQL

Install the postgresql-8.3 package from Synaptic or apt-get:

$ sudo apt-get install postgresql-8.3

You might also want to install the pgadmin3 tool to help you manage your database:

$ sudo apt-get install pgadmin3

Reset the password of the postgres user

The default superuser, called ‘postgres’, does not have a password by default. We need to add one:

$ sudo su postgres -c psql template1
template1=# ALTER USER postgres with PASSWORD 'password';
template1=# \q

Where ‘password’ is your password. After this we need to modify the password of the postgres UNIX user:

$ sudo passwd -d postgres
$ sudo su postgres -c passwd

You will be asked for a new password, enter the same password with the one you specify in the ALTER USER statement above.

Allow local users to access the server

The default PostgreSQL installation in Ubuntu requires that a PostgreSQL user must also be a unix user. I don’t like it this since it makes it hard for us to create a new PostgreSQL user. I want a PostgreSQL user to be different than a UNIX user. To do this, we need to change the configuration in the pg_hba.conf file:

$ sudo gedit /etc/postgresql/8.3/main/pg_hba.conf

Replace out the line (comment it out by adding a ‘#’ in front of it):

local all all ident sameuser

With this line:

local all all md5

After that you will need to restart the server:

$ sudo /etc/init.d/postgresql-8.3 restart

Now you’re all set. All you need to do is to create a new user, and a database and start coding.

Some important commands to remember:

  1. Creating a new PostgreSQL user
    $ sudo -u postgres createuser -d -R -P 
  2. Create a new database owned by
    $ sudo -u postgres createdb -O  
  3. Executing an SQL file
    $ psql -f   
  4. Removing a database
    $ dropdb -U  
  5. Removing a PostgreSQL user
    $ sudo -u postgres dropuser 
參考資料 Setup PostgreSQL in Ubuntu

19 則留言:

匿名 提到...

http://markonzo.edu http://www.netknowledgenow.com/members/Finasteride-Side-Effects.aspx http://aviary.com/artists/Atenolol-oral bermuda ticks http://www.netknowledgenow.com/members/Requip-Side-Effects.aspx http://www.netknowledgenow.com/members/Lortab-7.5.aspx http://blog.bakililar.az/norvasc/ http://clarinex.indieword.com/ http://aviary.com/artists/Ezetimibe yasuhiro

匿名 提到...

Good dispatch and this fill someone in on helped me alot in my college assignement. Thank you seeking your information.

匿名 提到...

instant online payday loans http://www.legitpaydayloansonline1.com/ Fundpopog [url=http://www.legitpaydayloansonline1.com]Payday loans online[/url] Stype Payday Loans Online online payday loans no credit check And the very respected american association not of home renovation, can save as per your special needs and requirements.Many of the borrowers are also concerned company, they will then determine the amount of money that you qualify for.Your loan will be on the day papers in state by the kind of vehicle that you intend to purchase.

匿名 提到...

Payday loans online http://www.legitpaydayloansonline2.com/ Fundpopog [url=http://www.legitpaydayloansonline3.com/]payday loans online[/url] Stype Payday Loans Online Payday loans online Also, since in most cases the entire loan processing, getting your the comfort and privacy of their home or office!So now to the reasons for your money within offered exponentially in the past few years here in the uk!

匿名 提到...

online payday loans http://www.legitpaydayloansonline2.com/ Fundpopog http://legitpaydayloansonline1.com Stype [url=http://www.legitpaydayloansonline1.com/]online payday loan[/url] online payday loans Should you skip a payment, you are application, delayed doesn't the best rate will contact you to discuss terms!Not just that but difficulties of scheme available online for everyone.A cash advance loan being a short term loan need multiple immediate and confined to a relatively small loan.

匿名 提到...

woodworking plans , http://woodworkingplans1.com/#WeflyGuenny ted woodworking

匿名 提到...

woodworking projects , http://woodworkingplans1.com/#WeflyGuenny woodworking projects

匿名 提到...

The Canon EOS 5D Mark II is $2,499 for body only or $3,299 with a 24'105mm lens. Red lights can be tricky but can be made to look good if you're careful.
But there are only a few that put out top quality cameras.


Here is my website: canon 6d

匿名 提到...

This handles web browsing and streaming music with no problems.

According to the Bangkok Post, there is a major announcement coming from Apple on September 12th, which will probably be
its new i - Phone. It also comes with a lifetime replacement
warranty from Armor Suit for the protector sheet.


Feel free to surf to my website: kindle fire

匿名 提到...

S Voice has been advertised to do certain things Siri couldn't, like launch a camera app or a voice recording app, however I don't think I was
able to get much out of S Voice. Samsung, the New York Times,
is reporting, is set to offer for sale the Samsung Galaxy
S IV which will offer automatic scrolling by monitoring eye
movements. On the other hand, Galaxy Note comes with three color choices – Black, White and Pink.


Feel free to surf to my web site ... samsung galaxy s3

匿名 提到...

The hot stuff COOLPIX S9100 can capture as much as your memorable images.
Of course, doing backup is the best way to avoid image loss.
The D7000 just may be the best performing APS-C format
camera in the market today.

Look at my web page: nikon d7100

匿名 提到...

The manufacturer claims if this can improve text entry speeds by 30%. 1 feels excellent within the hand not like the Motorola Xoom and the Acer Iconia A500. 3GHz Nvidia Tegra 3 quad-core processor plus 1GB of RAM.

Also visit my website ... samsung galaxy tab 2

匿名 提到...

Apple currently offers two sizes of Mac - Book
Air notebook, respectively 11. As expected, the models of consoles
offered include the Xbox 360, the Sony Playstation 3, and the Nintendo Wii.
ll need to go to a short URL on the Mac to download the desktop part of
the installer, which means the Mac and i - Pad must
be on a single Wi-Fi network.

My webpage: macbook air

匿名 提到...

The press conference saw the intro to hardware enhancements about the Samsung
galaxy note 2, and the profound interpretation of its major system functionalities.
But it is hard to hold it in one hand especially to female
users. 3 Mp, the camera is clearly aimed at competing with other
semi-high range cameras, not those that compete with those inside
a smartphone or tablet.

匿名 提到...

The Dell Streak packs in a 1GHz Snapdragon ARM-based processor made by Qualcomm, 5MP autofocus
camera with dual LED flash, VGA front-facing camera, integrated 3G + Wi-Fi, Bluetooth, and a
micro - SD expansion slot for up to 32GB of storage. The Black - Berry Playbook price has not yet been revealed
but it is thought that it could be up to £100 cheaper than the equivalent i - Pad model, which will
make it a very attractive proposition indeed once the Black
- Berry Playbook release date arrives. Blackberry Playbook runs on Blackberry tablet operating system.


Feel free to surf to my web blog: blackberry playbook review

匿名 提到...

Have you ever considered writing an ebook or guest authoring on other
sites? I have a blog based upon on the same ideas you discuss and would
love to have you share some stories/information. I know my subscribers would appreciate
your work. If you're even remotely interested, feel free to send me an e mail.

Also visit my page - twitter followers

匿名 提到...

Pretty nice post. I simply stumbled upon your blog and wished to
say that I've really loved browsing your weblog posts. After all I will be subscribing to your feed and I hope you write again soon!

My homepage guaranteed twitter followers

匿名 提到...

Excellent way of explaining, and nice article to obtain facts about my presentation subject matter, which i
am going to convey in university.

Here is my blog post ... way to buy real cheap twitter followers free

匿名 提到...

Yard - check for ant hills or evidence of moles and other insects that can damage your lawn.
If your gate changes at the airport, this app will alert you.
This keeps your unit from having to work so hard to heat the water.


Here is my blog post: nest thermostat