- mac OS packages
- Interactive installer by EDB
- Platform support
- Postgres.app
- Homebrew
- MacPorts
- PostgreSQL: зачем и как
- Установка PostgreSQL на Ubuntu 14.04
- Установка PostgreSQL на Mac OS X через Homebrew
- Установка PostgreSQL на Mac OS X через Postgresapp
- Проверка установки
- Базовые команды PostgreSQL
- Команды терминала psql
- PostgreSQL Setup : Mac Edition
- Reduce your efforts on PostgreSQL installation and issues in Mac OS with these 4 steps
- Step 1 : Getting Homebrew
- Step 2: Installing PostgreSQL
- Step 3: Initialize Database
- Step 4.1: Connect to database via command line
- 17 Practical psql Commands That You Don’t Want To Miss
- Summary: in this tutorial, we give you a list of common psql commands that helps you query data from PostgreSQL…
- Step 4.2: Connect to database via Popular GUIs
- Recommended GUIs
- 1. Postico
- 2. pgAdmin
- 3. DataGrip
- Installation of PostgreSQL on Mac OS
- 1. Downloading the installer
- 2. Launching the installation
- 3. Selecting the install location
- 4. Selecting components
- 5. Selecting where to store data (location of Data Directory)
- 6. Setting the superuser password
- 7. Selecting the port number
- 8. Setting locale
- 9. Review and installation
- 10. Checking the process
mac OS packages 
You can get macOS PostgreSQL packages from several different sources.
Interactive installer by EDB
Download the installer certified by EDB for all supported PostgreSQL versions.
This installer includes the PostgreSQL server, pgAdmin; a graphical tool for managing and developing your databases, and StackBuilder; a package manager that can be used to download and install additional PostgreSQL tools and drivers. Stackbuilder includes management, integration, migration, replication, geospatial, connectors and other tools.
This installer can run in graphical, command line, or silent install modes.
The installer is designed to be a straightforward, fast way to get up and running with PostgreSQL on macOS.
Advanced users can also download a zip archive of the binaries, without the installer. This download is intended for users who wish to include PostgreSQL as part of another application installer.
Platform support
The installers are tested by EDB on the following platforms. They will generally work on newer versions of macOS as well:
PostgreSQL Version | 64-bit macOS Platforms |
---|---|
13 | 10.14 — 11.0 |
12 | 10.13 — 10.15 |
11 | 10.12 — 10.14 |
10 | 10.11 — 10.13 |
9.6 | 10.10 — 10.12 |
Postgres.app
Postgres.app is a simple, native macOS app that runs in the menubar without the need of an installer. Open the app, and you have a PostgreSQL server ready and awaiting new connections. Close the app, and the server shuts down.
Homebrew
PostgreSQL can also be installed on macOS using Homebrew. Please see the Homebrew documentation for information on how to install packages.
A list of PostgreSQL packages can be found using the Braumeister search tool.
MacPorts
PostgreSQL packages are also available for macOS from the MacPorts Project. Please see the MacPorts documentation for information on how to install ports.
A list of PostgreSQL packages can be found using the portfiles search tool on the MacPorts website.
PostgreSQL packages are available for macOS from the Fink Project. Please see the Fink documentation for information on how to install packages.
A list of PostgreSQL packages can be found using the package search tool on the Fink website.
Copyright © 1996-2021 The PostgreSQL Global Development Group
Источник
PostgreSQL: зачем и как
По-умолчанию в качестве базы данных Rails предлагает использовать SQLite 3, автономную базу данных, которая неплохо подходит для получения первого опыта в разработке приложений. Одной из особенностей SQLite является невозможность одновременно выполнять более одной операции записи, поэтому чем скорее вы откажетесь от её использования, тем лучше. При разработке приложений зачастую практикуется подход, при котором development среда имеет минимум отличий от production среды. Это позволяет значительно уменьшить вероятность появления проблем, которые могут возникнуть из-за использования различных инструментов при разработке и при работе приложения в продакшене. Этот подход является одной из причин для того, чтобы задуматься об использовании PostgreSQL в разработке.
Здесь можно спросить себя: а почему именно PostgreSQL? Почему не MySQL или другая СУБД? Дело в том, что PostgreSQL стал фактически уже стандартом при работе над приложениями на Ruby on Rails. Он быстрый, расширяемый, адаптирован к высоким нагрузкам и использует такой подход к хранению данных, при котором достаточно сложно ошибиться, принимая те или иные решения (по сравнению, например, с MySQL).
Вот несколько ссылок, которые наглядно перечисляют все за и против:
Поскольку для разработки на Rails имеет смысл использовать OS X или ОС семейства Linux, рассмотрим установку PostgreSQL для Ubuntu и Mac OS X.
Содержание:
Установка PostgreSQL на Ubuntu 14.04
Во-первых, обновим удаленные репозитории:
Затем непосредственно установим PostgreSQL:
Строго говоря, база данных установлена. Убедимся в этом, войдя в терминал СУБД под стандартным пользователем postgres:
Если СУБД установлена корректно, в терминале появится ответ с приглашением к вводу команд:
Установка PostgreSQL на Mac OS X через Homebrew
Одним из наиболее простых способов установки PostgreSQL на OS X является Homebrew. Обновим список пакетов:
Если вы хотите, чтобы СУБД запускалась при старте системы, выполните команду:
Установка PostgreSQL на Mac OS X через Postgresapp
Помимо Homebrew СУБД PostgreSQL можно установить так же при помощи специального комплекта приложений, доступного для скачивания по адресу http://postgresapp.com/.
Пакет включает в себя саму PostgreSQL, PostGIS и еще несколько популярных расширений, отсутствие которых, впрочем, нисколько не помешает вам начать разрабатывать Rails-приложения использующие PostgreSQL.
Установка производится перетаскиванием иконки из загруженного пакета в папку Applications (Программы).
Проверка установки
Создадим тестовую базу данных:
Выйдем из терминала СУБД, введя команду \q и попробуем войти туда снова, используя свежесозданного пользователя:
После ввода пароля, терминал PostgreSQL поприветствует нас приглашением к вводу команд:
Для надежности проверим, может ли пользователь работать с текущей базой данных:
Таблица unicorns создалась, значит все в порядке, PostgreSQL установлен и готов к работе.
Базовые команды PostgreSQL
Чтобы работать с PostgreSQL, необходимо знать некоторые базовые команды. Некоторые из них, наиболее полезные, приведены ниже.
Вход в PostgreSQL:
Стандартный администраторский вход:
Команды терминала psql
- \dt – показать все таблицы
- \q – выход из терминала psql
- \dn – показать все схемы
- \du – показать всех пользователей
- \d имя_таблицы — показать информацию о таблице
И помните, что в любой непонятной ситуации стоит обращаться к официальной документации: http://www.postgresql.org/docs/, которой, в отличии от доков к MySQL, удобно пользоваться 😉
Мы рассказываем, как стать более лучшим разработчиком, как поддерживать и эффективно применять свои навыки. Информация о вакансиях и акциях эксклюзивно для более чем 8000 подписчиков. Присоединяйся!
- mkdev
- Менторы
- Специализации
- Контент
- Стать ментором
- О проекте
- Для компаний
- Что такое менторство
- Как проходит обучение
- Цены
- FAQ
- Impressum
- Аккаунт
- Записаться
- Войти
- Соцсети
© Copyright 2014 — 2021 mkdev | Privacy Policy | Lang: Russian
Источник
PostgreSQL Setup : Mac Edition
Reduce your efforts on PostgreSQL installation and issues in Mac OS with these 4 steps
PostgreSQL, also known as Postgres, is a free and open-source relational database management system emphasizing extensibility and technical standards compliance. It is designed to handle a range of workloads, from single machines to data warehouses or Web services with many concurrent users.
If you already have Homebrew installed, you can skip to Installing PostgreSQL. Otherwise, let’s keep going.
Step 1 : Getting Homebrew
To install PostgreSQL on the command line we will be using a package manager called Homebrew. In MacOSX 10.7 or higher, the Ruby interpreter comes pre-installed. Let’s start by copying and pasting the following command into our command line:
Step 2: Installing PostgreSQL
The first thing we’re going to do is install Postgres. There are two main ways to get Postgres onto your machine:
- Using a graphical installer like BigSQL or Postgres.app (Requires macOS 10.12 for latest)
- Using a package manager to install via the command line.
You can pick whichever option is right for you. For this tutorial, let’s see how to install on the command line.
How to check if PostgreSQL is installed in you mac?
Remove previous versions of PostgreSQL
Delete all Files of Postgres
Install Postgres with Homebrew
Start PostgreSQL server
To have launchd start postgresql now and restart at login:
Or, if you don’t want/need a background service you can just run:
Step 3: Initialize Database
If terminal shows an error like below:
Remove old database file
rm -r /usr/local/var/postgres
Run the initdb command again
Step 4.1: Connect to database via command line
Postgres works pretty hard to make itself usable right out of the box without you having to do anything. By default, it automatically creates the user postgres . Let’s see what other users it has created. Let’s start by using the psql utility, which is a utility installed with Postgres that lets you carry out administrative functions without needing to know their actual SQL commands.
Start by entering the following on the command line:
(You may need to use sudo psql postgres for this command to work, depending on how your system is configured).
17 Practical psql Commands That You Don’t Want To Miss
Summary: in this tutorial, we give you a list of common psql commands that helps you query data from PostgreSQL…
Step 4.2: Connect to database via Popular GUIs
There are many clients for PostgreSQL on the Mac. You can find many of them in the Community Guide to PostgreSQL GUI Tools in the PostgreSQL wiki. Some of them are quite powerful; some are still a bit rough. Here’s a list of all the Mac Apps I found (in alphabetic order):
Recommended GUIs
1. Postico
Postico is a modern Postgres client for OSX, built by the same developer who built Postgres.app (mentioned above). It is free, but you can buy a license to unlock additional power features. This is the GUI that I use to manage Postgres because it is built specifically for Mac and has a beautiful, very easy to use (but powerful) UI. It also includes an SQL editor for complex queries.
2. pgAdmin
pgAdmin is the oldest of the Postgres GUIs, its first version being released just a few months after Postgre’s first release in 1996. Having been rewritten several times, it can run on Linux, MacOSX, and Windows, and features powerful database management tools including a syntax-highlighted SQL editor. Designed to run on both client machines and on deployed servers, pgAdmin is capable of handling advanced cases that Postico cannot. It’s dashboard is one of it’s kind and is an absolute essential tool when using Postgres in a distributed microservice architecture.
3. DataGrip
DataGrip is my favorite when it comes to IDEs. It is a modern IDE developed by JetBrains that offers efficient schema navigation, an intelligent query console, and version control integration. DataGrip also resolves references in your SQL code and helps you refactor them.
Источник
Installation of PostgreSQL on Mac OS
SUMMARY: This article provides instructions for installing PostgreSQL on the Mac operating system. It covers the following steps:
1. Downloading the installer
2. Launching the installation
3. Selecting the install location
4. Selecting components
5. Selecting where to store data
6. Setting the user password
7. Selecting the port number
8. Setting locale
9. Review and installation
10. Checking the process
Installing PostgreSQL on Mac OS is easy, and in this post we will review all the necessary steps to get it up and running.
Note: The method we are using here to install PostgreSQL takes advantage of the installers EnterpriseDB provides. There are other methods for installing PostgreSQL on Mac as well, and they can be found here: https://www.postgresql.org/download/macosx/.
1. Downloading the installer
Visit the downloads page of EnterpriseDB’s website, https://www.enterprisedb.com/downloads/postgres-postgresql-downloads. Download your preferred version from the list available.
2. Launching the installation
Run the downloaded dmg package as administrator user. When you get the screen below, click on “Next” button:
3. Selecting the install location
You will be asked to specify which directory you wish to use to install Postgres. Select your desired location and click “Next”:
4. Selecting components
You will next be asked to select the tools that you want to install along with the Postgres installation. PostgreSQL server and command line tools are compulsory. Stack Builder and pgAdmin 4 are optional. Please select from the list and click “Next”:
5. Selecting where to store data (location of Data Directory)
You will be asked to select the location for your Postgres cluster’s Data Directory. Please select an appropriate location and click “Next”:
6. Setting the superuser password
You will be asked to provide the password of Postgres Unix superuser, which will be created at the time of installation. Please provide an appropriate password and click “Next”:
7. Selecting the port number
You will be asked to select the port number on which the PostgreSQL server will listen for incoming connections. Please provide an appropriate port number. (The default port number is 5432.) Make sure the port is open from your firewall and the traffic on that port is accessible. Click “Next”:
8. Setting locale
Please select appropriate locale (language preferences) and click “Next”:
9. Review and installation
You will be provided a summary of your selections from the previous installation screens. Review it carefully and click “Next” to complete the installation:
10. Checking the process
Your installation is completed successfully and you can also confirm the same by connecting to a terminal and running the following command:
This will confirm the processes running for Postgres after the installation:
Источник