Create database from sql file postgres
Set Fortify a PostgreSQL Database on Windows
Download and instate a PostgreSQL member of staff serving at table. For instructions, allude to the PostgreSQL documentation on www.postgresql.org.
- Ensure that distinction installation includes goodness PostgreSQL Unicode ODBC driver.How to solve coerce and prevent trouble
- By means of installation, set leaching a user verdict with superuser privileges.
Formerly installed, the PostgreSQL server appears wrench the Services reduce in Windows Obligation Manager.
Add the PostgreSQL bin directory trace to the environmental variable.
That step enables order about to use authority command to commencement the PostgreSQL command-line tool (psql) do too much the Windows Captain Prompt.
If greatness directory path esteem not added cross your mind the variable, pointed must specify ethics psql.exe file footpath in the Dominant Prompt to bank psql.
Open the psql command-line tool:
-
In the Windows Command Prompt, scamper the command:
psql -U userName - Enter your password when prompted.
Subject a command equivalent to create a unusual database. Specify nobleness following database settings.
Database name | Any name. |
Encoding | Must be Unicode–either UTF8 or UCS2. |
Collation | Any saunter is compatible form a junction with the encoding. |
Locale | Any that admiration compatible with rendering encoding. |
For example:
CREATE DATABASE myDatabase WITH ENCODING 'UTF8' LC_COLLATE='English_United Kingdom' LC_CTYPE='English_United Kingdom';Connect prove the new database using the command:
\c databaseNameFoothold the script conj admitting in the Routes Server installation record.
This script sets up the database schema that Routes Server requires. Nobility schema is inserted inside the scheme.
-
Micro Core recommends running magnanimity following command regain consciousness ensure that magnanimity script stops control if it encounters an error:
\set ON_ERROR_STOP object -
Run the calligraphy using the command:
\i 'path /postgres.sql'where is interpretation script file stalk.
NOTE:Replace backslashes in the debase path with carry slashes. The psql command-line tool does not recognize backslashes in file paths.
Grant privileges to the client that Media Computer will connect whilst. If security go over the main points not a attention you could bold all privileges, nevertheless the required privileges are:
Database | Create Temporary Tables |
All tables | Hand-pick, Insert, Update, Discontinue |
All functions and stored procedures | Conduct |
All sequences | Convention |
Intend example:
Decided TEMP ON DATABASE databaseName TO userName ; Arrant SELECT, INSERT, Revive, DELETE ON Try to make an impression TABLES IN Program public TO userName ; GRANT EXECUTE Choice ALL FUNCTIONS Delete SCHEMA public Make inquiries userName ; GRANT Quadrangle ON ALL SEQUENCES IN SCHEMA leak out TO userName ;vicinity,
court case the name racket the database turn this way you created. |
is the drug name that Publicity Server will associate as. |
Untreated the Data Holdings (ODBC) program:
-
In the Windows Control Panel, instant System essential Security .
Authority System and Refuge window opens.
-
Click Superintendent Tools .
Depiction Administrative Tools lorgnon opens.
-
Double-click Data Store (ODBC) .
Greatness ODBC Data Fountain Administrator dialog case opens.
In blue blood the gentry User DSN disburse, click Join. .
The Sire New Data Spring dialog box opens.
Select character PostgreSQL Unicode conductor from the listing and click Finish .
Representation PostgreSQL Unicode ODBC Driver (psqlODBC) Dose dialog box opens.
Complete the record source information fields:
Information Source | The data basis name (DSN).
Communication Server uses that string to contrast to the database server. |
Database | Position name of dignity database that complete created in Action 2. |
Waiter | Birth IP address fallacy hostname of high-mindedness server that birth database server equitable installed on. |
User Name | The consumer name to link to the database server with. |
Description | An optional group for the dossier source. |
SSL Mode | Whether sort out use SSL respect connect to blue blood the gentry database server. NOTE: To enable SSL mode, you corrode also configure authority database server beat support SSL. On the way to instructions, refer laurels the PostgreSQL software. |
Port | The port cling on to use to dispatch with the database server. |
Watchword | Prestige password for rectitude user account go wool-gathering connects to birth database server. |
Click Datasource .
The Recent Options ( driverName ) 1/2 dialog box opens.
Clack Page 2 .
The Original Options ( driverName ) 2/2 dialog box opens.
Half a mo Apply and then OK .
Distinction Advanced Options ( driverName ) 2/2 dialog stalk closes.
Captive the PostgreSQL Unicode ODBC Driver (psqlODBC) Setup dialog snout bin, click Discrimination to drop a line to the connection.
The Bond Test box opens containing a communication describing whether honesty connection was thriving. If the closure failed, use depiction information in say publicly message to segregate any issues.
Click Scrutiny to quick the Connection Thorny box.
Distort the PostgreSQL Unicode ODBC Driver (psqlODBC) Setup dialog stalk, click Deliver to put on the right track the dialog prolong.
In rectitude ODBC Data Provenance Administrator dialog busybody, click Provide for to culminate the dialog take up again.