For Postgres, I keep getting this error multiple times even though I have already set the location of the bin
folder to the path variable in Windows 8. Is there something else I’m missing?
John Smith
7,2536 gold badges49 silver badges61 bronze badges
asked May 22, 2015 at 16:15
5
Just an update because I was trying it on Windows 10 you do need to set the path to the following:
;C:\Program Files\PostgreSQL\14\bin ;C:\Program Files\PostgreSQL\9.5\lib
PS : 14 is the current version, check whatever version you are on.
You can do that either through the CMD by using set PATH [the path]
or from my
computer => properties => advanced system settings=> Environment
Variables => System Variables
Then search for path.
Important: don’t replace the PATHs that are already there just add one beside them as follows ;C:\Program Files\PostgreSQL\9.5\bin ;C:\Program Files\PostgreSQL\9.5\lib
Please note: On windows 10, if you follow this: computer => properties => advanced system settings=> Environment Variables => System Variables> select PATH, you actually get the option to add new row. Click Edit, add the /bin and /lib folder locations and save changes.
Then close your command prompt if it’s open and then start it again
try psql —version
If it gives you an answer then you are good to go if not try echo %PATH%
and see if the path you set was added or not and if it’s added is it added correctly or not.
Important note:
Replace 9.5 with your current version number. As of 2021, that is 13.
For 2022 is 14.
answered Jul 10, 2016 at 20:50
ShahinShahin
2,5371 gold badge13 silver badges17 bronze badges
2
Enter this path in your System environment variable.
C:\Program Files\PostgreSQL\[YOUR PG VERSION]\bin
In this case i’m using version 10. If you check the postgres folder you are going to see your current versions.
In my own case i used the following on separate lines:
C:\Program Files\PostgreSQL\10\bin
C:\Program Files\PostgreSQL\10\lib
answered Jan 16, 2020 at 13:34
1
Windows 10
It could be that your server doesn’t start automatically on windows 10 and you need to start it yourself after setting your Postgresql path using the following command in cmd:
pg_ctl -D "C:\Program Files\PostgreSQL\11.4\data" start
You need to be inside «C:\Program Files\PostgreSQL\11.4\bin» directory to execute the above command.
EX:
You still need to be inside the bin directory to work with psql
answered Jul 18, 2019 at 18:17
Abdel-RaoufAbdel-Raouf
7001 gold badge8 silver badges20 bronze badges
You can follow the following steps below.
C:\Program Files\PostgreSQL\yourversion
answered Aug 19, 2021 at 16:35
I had your issue and got it working again (on windows 7).
My setup had actually worked at first. I installed postgres and then set up the system PATH variables with C:\Program Files\PostgreSQL\9.6\bin; C:\Program Files\PostgreSQL\9.6\lib
. The psql keyword in the command line gave no errors.
I deleted the PATH variables above one at a time to test if they were both really needed. Psql continued to work after I deleted the lib path, but stopped working after I deleted the bin path. When I returned bin, it still didn’t work, and the same with lib. I closed and reopened the command line between tries, and checked the path. The problem lingered even though the path was identical to how it had been when working. I re-pasted it.
I uninstalled and reinstalled postgres. The problem lingered. It finally worked after I deleted the spaces between the «; C:…» in the paths and re-saved.
Not sure if it was really the spaces that were the culprit. Maybe the environment variables just needed to be altered and refreshed after the install.
I’m also still not sure if both lib and bin paths are needed since there seems to be some kind of lingering memory for old path configurations. I don’t want to test it again though.
answered Nov 27, 2016 at 9:18
voluntiervoluntier
3404 silver badges11 bronze badges
If you tried all the answers and still spinning your heads, don’t forget to change the version with your one which you downloaded.
For example, don’t simply copy paste
;C:\Program Files\PostgreSQL\9.5\bin ;C:\Program Files\PostgreSQL\9.5\lib
More clearly,
;C:\Program Files\PostgreSQL\[Your Version]\bin ;C:\Program Files\PostgreSQL\[Your Version]\lib
I was spinning my heads. Hope this helps.
answered Dec 13, 2018 at 4:49
2
Make sure that the path actually leads to the executables. I’m using version 11 and it did not work until this was set as the path:
C:\Program Files\PostgreSQL\11\bin\bin
Maybe this is how version 11 is structured or I somehow botched the installation but I haven’t had a problem since.
answered Feb 13, 2019 at 4:38
NateNate
511 silver badge1 bronze badge
Even if it is a little bit late, i solved the PATH problem by removing every space.
;C:\Program Files\PostgreSQL\<installed version>\bin;C:\Program Files\PostgreSQL\<installed version>\lib
works for me now.
answered Aug 17, 2018 at 8:34
derRichterderRichter
511 silver badge4 bronze badges
0
Simple solution that hasn’t been mentioned on this question: restart your computer after you declare the path variable.
I always have to restart — the path never updates until I do. And when I do restart, the path always is updated.
answered Apr 18, 2020 at 19:23
Michael JayMichael Jay
5033 silver badges15 bronze badges
Find your binaries file where it is saved. get the path in terminal mine is
C:\Users\LENOVO\Documents\postgresql-9.5.21-1-windows-x64-binaries (1)\pgsql\bin
then find your local user data path, it is in mostly
C:\usr\local\pgsql\data
now all we have to hit the following command in the binary terminal path:
C:\Users\LENOVO\Documents\postgresql-9.5.21-1-windows-x64-binaries (1)\pgsql\bin>pg_ctl -D "C:\usr\local\pgsql\data" start
done!
answered May 13, 2020 at 23:10
For Windows 10 and 11 users, here are the steps:
- Go to Edit environment variables for your account (search for it on the start menu)
- It will open the System Properties form — click the Environment Variables
- Under the User variables for <username> (or you can add it in system variables), find the path variables and click edit, and add the path to your Postgres bin file address (in my case it’s C:\Program Files\PostgreSQL\15\bin).
- And save it and re-open the terminal.
answered Nov 25, 2022 at 13:24
Tri DawnTri Dawn
5506 silver badges11 bronze badges
You can use psql
on CMD on Windows 11.
First, search and click Edit the system environment variables as shown below:
Then, click Environment Variables as shown below:
Lastly, set C:\Program Files\PostgreSQL\<version>\bin
to Path either in User variables or System variables or both as shown below. *Only the currently logged-in specific user can access User variables while all users can access System variables:
...
C:\Program Files\PostgreSQL\13\bin
C:\Program Files\PostgreSQL\14\bin
C:\Program Files\PostgreSQL\15\bin
answered Aug 11 at 11:51
In my case, the error message was caused by the pg_env.bat script extending the path surrounded with «…»
@SET PATH=**"**C:\Program Files\PostgreSQL\14\bin**"**;%PATH%
should be
@SET PATH=C:\Program Files\PostgreSQL\14\bin;%PATH%
Without the «..» it worked for me.
answered Sep 26 at 20:16
DELUXEnizedDELUXEnized
1,24816 silver badges22 bronze badges
1
Always better to install a previous version or in the installation make sure you specify the ‘/data’ in a separate directory folder «C:\data»
answered Oct 6, 2020 at 13:34
0
I kept trying these solutions to no avail, then I realised that my error was that I was adding new environment variables instead of editing the PATH variable. We need to add the
;C:\Program Files\PostgreSQL\9.5\bin;C:\Program
Files\PostgreSQL\9.5\lib
to the existing PATH variable, NOT create new variables. Leaving this here in case someone else gets stuck with the same mistake.
answered Jul 3 at 16:44
CandeCande
1512 silver badges5 bronze badges
Configured everything in the system environment variables PATH but still getting an error via MSSQL stored procedure:
'psql' is not recognized as an internal or external command, operable program or batch file.
So, I Try this and worked for me [Problem Solved]:
SET @v_connect = 'postgresql://' + @v_user_id + ':' + @v_password + '@' + @v_host + ':' + @v_port + '/' + @v_database + ' < "' + @v_server_path + 'CONTROL\'
SET @v_sql = 'cd "C:\Program Files\PostgreSQL\14\bin\" && psql ' + @v_connect + @v_output_sql_script_nm + @v_quote
PRINT ' ** What vSQL Say: ' + @v_sql + ' **'
EXEC @v_cmd_result = XP_CMDSHELL @v_sql
Here I first go into that command location then execute it
Take look at this part of code: ‘cd «C:\Program Files\PostgreSQL\14\bin» && psql ‘
answered Sep 13 at 20:44
RajeshRajesh
5621 gold badge10 silver badges26 bronze badges
PostgreSQL is a popular open-source relational database management system. On Windows, the default installation of PostgreSQL does not add the psql
executable to your system’s PATH. As a result, you may receive the «psql: command not found» error when trying to run psql
from the command prompt.
In this article, we’ll explore several ways to resolve this issue and run psql
on Windows.
Option 1: Adding psql
to the PATH
One of the easiest ways to resolve the «psql: command not found» error is to add the psql
executable to your system’s PATH. Here’s how:
- Open the Start menu and search for «Environment Variables».
- Click on «Edit the system environment variables».
- In the System Properties dialog box, click on the «Environment Variables» button.
- Scroll down to the «System variables» section and locate the «Path» variable.
- Click on the «Edit» button to modify the PATH.
- Click on the «New» button and add the path to the
psql
executable, which is typically located atC:\Program Files\PostgreSQL\[version number]\bin
. - Close the dialog boxes and open a new command prompt window.
You should now be able to run psql
from the command prompt.
Option 2: Running psql
with the full path
Another option is to run psql
with the full path to the executable. Here’s an example:
C:\Program Files\PostgreSQL\[version number]\bin\psql.exe
This method is useful if you only need to run psql
occasionally and don’t want to add it to your system’s PATH.
Option 3: Creating a Shortcut to psql
A third option is to create a shortcut to psql
on your desktop or in your Start menu. Here’s how:
- Locate the
psql.exe
file in thebin
directory of your PostgreSQL installation (e.g.,C:\Program Files\PostgreSQL\[version number]\bin\psql.exe
). - Right-click on the file and select «Create Shortcut».
- Drag the shortcut to your desktop or Start menu.
You can now run psql
by double-clicking the shortcut.
Option 4: Running psql
from the PostgreSQL Installation Directory
Finally, you can run psql
from the PostgreSQL installation directory by navigating to the bin
directory in the command prompt and executing the psql
command. Here’s an example:
cd C:\Program Files\PostgreSQL\[version number]\bin psql
This method is useful if you need to run psql
frequently and don’t want to add it to your system’s PATH or create a shortcut.
Conclusion
In this article, we explored several ways to resolve the «psql: command not found» error on Windows and run the psql
executable. Whether you choose to add psql
to your system’s PATH, run it with the full path, create a shortcut, or run it from the PostgreSQL installation directory, you should now be able to use psql
on your Windows system.
Connecting to a Database using psql
Once you have resolved the «psql: command not found» error, you can use the psql
command to connect to a PostgreSQL database. The basic syntax for connecting to a database is as follows:
psql -U [username] -d [database name]
where username
is the name of the database user and database name
is the name of the database you want to connect to. For example:
psql -U postgres -d mydatabase
This will prompt you for a password for the postgres
user. Once you have entered the password, you will be connected to the mydatabase
database.
Basic psql Commands
Once you are connected to a database using psql
, you can run various SQL commands to manipulate the data in the database. Here are some basic psql
commands:
\l
: List all databases.\c [database name]
: Connect to a different database.\dt
: List all tables in the current database.\d [table name]
: Describe the columns in a table.\q
: Quitpsql
.
For a complete list of psql
commands, you can run the \?
command while in the psql
prompt.
Importing and Exporting Data with psql
In addition to running SQL commands, you can also use psql
to import and export data to and from a PostgreSQL database. Here are some examples:
Exporting Data
To export data from a table to a file, you can use the \copy
command in psql
. The basic syntax is as follows:
\copy [table name] to '[file name]' with (format '[format]');
where table name
is the name of the table you want to export, file name
is the name of the file you want to export to, and format
is the format of the exported data (e.g., csv
, tab
, etc.). For example:
\copy mytable to 'mytable.csv' with (format 'csv');
This will export the data from the mytable
table to a file named mytable.csv
in CSV format.
Importing Data
To import data from a file into a table, you can use the \copy
command in psql
. The basic syntax is as follows:
\copy [table name] from '[file name]' with (format '[format]');
where table name
is the name of the table you want to import to, file name
is the name of the file you want to import, and format
is the format of the imported data (e.g., csv
, tab
, etc.). For example:
\copy mytable from 'mytable.csv' with (format 'csv');
This will import the data from the mytable.csv
file into the mytable
table.
In conclusion, psql
is a powerful tool for managing PostgreSQL databases on Windows. With the ability to connect to databases, run SQL commands, and import and export data, psql
is a valuable tool for developers and database administrators
Popular questions
- What is the reason for the «psql: command not found» error in Windows?
Answer: The «psql: command not found» error occurs in Windows when the psql
executable is not in the system’s PATH environment variable.
- How do I resolve the «psql: command not found» error in Windows?
Answer: To resolve the «psql: command not found» error, you can either add the directory containing the psql
executable to the PATH environment variable or specify the full path to the psql
executable when running the command.
- How do I connect to a PostgreSQL database using
psql
in Windows?
Answer: To connect to a PostgreSQL database using psql
, use the following command:
psql -U [username] -d [database name]
where username
is the name of the database user and database name
is the name of the database you want to connect to.
- What are some basic
psql
commands for manipulating data in a PostgreSQL database?
Answer: Some basic psql
commands for manipulating data in a PostgreSQL database include \l
to list all databases, \c [database name]
to connect to a different database, \dt
to list all tables in the current database, \d [table name]
to describe the columns in a table, and \q
to quit psql
.
- How do I import and export data using
psql
in Windows?
Answer: To export data from a table to a file, use the following psql
command:
\copy [table name] to '[file name]' with (format '[format]');
where table name
is the name of the table you want to export, file name
is the name of the file you want to export to, and format
is the format of the exported data (e.g., csv
, tab
, etc.). To import data from a file into a table, use the following psql
command:
\copy [table name] from '[file name]' with (format '[format]');
where table name
is the name of the table you want to import to, file name
is the name of the file you want to import, and format
is the format of the imported data (e.g., csv
, tab
, etc.).
Tag
PostgreSQL
Follow us on Social Media
Psql Command Not Found Windows With Code Examples
In this session, we will try our hand at solving the Psql Command Not Found Windows puzzle by using the computer language. The following piece of code will demonstrate this point.
export PATH=/Library/PostgreSQL/9.5/bin:$PATH
The solution to the same problem, Psql Command Not Found Windows, can also be found in a different method, which will be discussed further down with some code examples.
Assuming you installed PostgreSQL on Windows with the PostgreSQL "One-click" installer packaged by EnterpriseDB, psql is not added to the PATH automatically. That's partly because adding it to the path could otherwise cause confusion when people have multiple versions of PostgreSQL installed. You need to specify the full explicit path to psql, eg: "%PROGRAMFILES%\Postgresql\9.2\bin\psql.exe" or add psql to the user PATH environment variable, see eg this guide.
We were able to comprehend how to correct the Psql Command Not Found Windows issue thanks to the many examples.
How do I enable PostgreSQL on Windows?
2. On Windows
- Open Run Window by Winkey + R.
- Type services. msc.
- Search Postgres service based on version installed.
- Click stop, start or restart the service option.
Where is psql located Windows?
On Windows, the default data folder is C:\Program Files\PostgreSQL\x.x\data.
How do I run psql EXE?
Open the psql command-line tool:
- In the Windows Command Prompt, run the command: psql -U userName.
- Enter your password when prompted.
How do you check if postgres is installed Windows?
The quick way to verify the installation is through the psql program. First, click the psql application to launch it. The psql command-line program will display. Second, enter all the necessary information such as the server, database, port, username, and password.
How do you check if postgres is installed?
Check Postgres Version from SQL Shell Type the following SQL statement within the prompt to check the current version: SELECT version(); The resulting output provides the full version and system information for the PostgreSQL server.21-Apr-2020
How do I start PostgreSQL in terminal?
`psql` on Terminal To get to the PostgreSQL terminal, open your terminal, start the database services ( brew services start postgresql) , then run psql . Thank you!11-Jul-2018
How do you install psql?
How to Download and Install PostgreSQL on Windows
- Download PostgreSQL Installer.
- Install PostgreSQL on Windows.
- Connect to the PostgreSQL Database. Connect to the PostgreSQL Database Using the SQL Shell (psql) Connect to the PostgreSQL Database Using pgAdmin.
Where is psql installed?
All files will be installed under /usr/local/pgsql by default. You can customize the build and installation process by supplying one or more command line options to configure .
How install PostgreSQL on windows10?
How to Download & Install PostgreSQL
- Step 1) Open your browser. Go to https://www.postgresql.org/download and select Windows.
- Step 2) Check options.
- Step 3) Select PostgreSQL version.
- Step 4) Open exe file.
- Step 5) Update location.
- Step 6) Select components.
- Step 7) Check data location.
- Step Enter password.
What is psql command?
psql is a terminal-based front-end to PostgreSQL. It enables you to type in queries interactively, issue them to PostgreSQL, and see the query results.
Follow us on Social Media
PostgreSQL is a widely used relational database that supports various CLI and GUI tools. These tools assist us in managing and manipulating databases efficiently. The traditional way of working with Postgres is using a CLI tool.
SQL Shell aka “psql” is an interactive command line tool that helps us access PostgreSQL via the terminal. However, while accessing Postgres via psql, you may encounter the “psql command not found error”. The stated error arises because of various reasons.
This blog post will present a detailed guide on how to resolve the psql command not found error using one of the following fixes:
— Install Postgres
— Set Environment Variable
How to Fix psql Command Not Found Error in Postgres?
In PostgreSQL, the “psql command not found” error or the “psql” is not recognized as an internal or external command arises because of the following reasons:
— Postgres is not installed on the Machine.
— The Path for Postgres tools is not set on our system.
The stated error can be fixed either by installing PostgreSQL or by setting the environment variable for the Postgres tools.
Solution 1: Download and Install Postgres
The very first reason that causes this error is Postgres is not installed on the system. In that case, installing Postgres will rectify the stated problem.
Solution 2: Set Environment Variable
The primary reason which leads to the command not found error is that the path for the Postgres tools is not set on the system. In such a case, you can enforce one of the following solutions:
— Set Path Using Command Prompt
— Set Path Using Edit System Environment Variables
Setting Path Using Command Prompt
Open the windows search menu by pressing the “🪟 + S” button. Search CMD, and launch it as an administrator. Once the CMD terminal is open, execute the “setx” command to set the path for the Postgres tools using CMD:
setx /M path "%PATH%;C:\Program Files\PostgreSQL\15\bin"
In this command:
— “/M” is used to set the variable at the SYSTEM level/scope.
— “15” represents the Postgres version installed on our system. You must replace the with the Postgres version installed on your OS:
The Postgres bin directory’s path has been set successfully. For confirmation, you can re-launch the CMD and type any psql command:
The Postgres version confirms that the stated error has been rectified.
Setting Path Using Edit System Environment Variables
Open the “Edit the System Environment Variables” settings from the Windows search menu:
Click on the “Environment variables…” button to launch the system properties:
Select the path variable available under the system variables and hit the “Edit” button:
Now, copy the “bin directory’s path”, click on the “New” button, and paste the copied path here:
Click on the “OK” button to add the path to the “Edit Environment Variables” window. Next, hit the “OK” button to close the “Environment Variables” Window:
Next, close the “System Properties” Window by clicking on the “OK” button:
Setting the path for the Postgres tools will fix the «psql command not found» error.
Conclusion
In PostgreSQL, the “psql command not found” or “psql is not recognized as an internal or external command” error arises if Postgres is not installed or the path for Postgres tools is not set on your system. Installing Postgres or setting up the environment for Postgres will fix this error. This post explained a couple of solutions to fix the “psql command not found error” in PostgreSQL.
from someone writing into to devcenter feedback
After installing postgresql on windows, I’m unable to run heroku pg:psql. It gives me the message «The local psql command could not be located». I tried adding the path to the PATH environment variable. I’m able to run the command myself (by typing psql), but heroku still can’t find the executable.
I haven’t heard any further info here (and don’t really have direct access to ask them follow up questions). So I’ll close for now, but keep an eye out.
When this occurred for me the issue was with quotes in the Windows path, so just a local config issue.
Originally I had «C:\Program Files\PostgreSQL\9.1\bin» (with quotes) at the end of PATH. The PSQL command runs, but starts by displaying:
could not find a «psql» to execute
Running «heroku pg:psql DBNAME» failed with the message «The local psql command could not be located».
After resetting PATH to leave out the quote PSQL runs without an error, and heroku pg:psql DBNAME connects to the remote DB.
@stprior — thanks for the extra info, should help me explain if anybody else runs into it.
Hello, I am getting a similar issue, I tried to remove the quotes in the path mentioned by stprior but it didnot solve the issue. Is there any other solution or things I need to check?
Thanks
I have the same issue. About to check whether the quotes removal helps — running on Windows 7, and yes my path does contain spaces which I quoted due to earlier issues without the quotes…..
Thank you stprior, your suggestion worked.
Make sure to restart the command shell after changing the contents of the Windows path. This solved my issue (after adding the Postgresql bin directory to my path).
(for newbies)
In Command Prompt write:
set PATH=%PATH%;C:\Program Files\PostgreSQL\9.2\bin\
Change the above directory e.g. «C:\Program Files\PostgreSQL\9.2» to your installed postgresql’s ‘bin’ directory.
Anyone know how to get this working in the Cygwin bash terminal?
Mine still doesn’t work… but it worked on a friend’s computer
Same problem, Windows 8. Added C:\Program Files\PostgreSQL\9.3\bin, didn’t work.
Added «C:\Program Files\PostgreSQL\9.3\bin» Still didn’t work.
! The local psql command could not be located
When I run «heroku pg:psql»
It works fine.
A clue anyone ?
Thanks
I guess it’s not relevant When I run psql in the Command Line it runs and prompt for a password I don’t know(How can i retrieve it?)..
@yloewidt, were you ever able to solve this issue? I’m running Windows 7 and all my path variables are set up correctly, since I can access psql locally as well as run ‘heroku pg:psql’. pg:ps or pg:push, no luck.
I am also having this problem using Windows 8 and PG 9.3.4. Running psql at command prompt gives me the expected postgres=# prompt. However, running:
heroku pg:push postgres_db_name HEROKU_POSTGRESQL_AMBER_URL —app myapp
Returns «The local psql command could not be located». My PATH seems appropriately set up, and when I run rails console and execute this statement:
exec «psql»
I am presented with the postgres prompt. I’m looking through the code to see if I can figure out what is going on because it’s a frustrating problem to have.
What is happening is that dump_restore_cmd in pg_dump_restore.rb returns a string like this:
env PGPASSWORD= PGSSLMODE=prefer pg_dump ...
which is the string that’s called as part of the private run function here
def run system dump_restore_cmd end
Executing this on Windows raises Errno::ENOENT (because the Windows command line fails to find an executable called «env»), resulting in the error message we’re seeing. I think stripping out or changing the way the environment variables are set will fix this issue. For now, I’m just going to use this to format the statement the way I need it and run pg_dump and pg_restore manually.
@adamscruggs good catch and explanation. I’ve patched it on master here: 6f43cf7
I’ll try to get a release out soon. Part of the confusion above was that the error message looks the same, but has a much different cause (lacking psql
in path vs lacking env
in path). So hopefully we’ll have this sorted more completely soon.
Remove the quotes fixed my problem.
A reboot fixed it for me. I think because that forces cygwin to update its path.
@will I am on Windows 8.1 with Postgres 9.4 on AMD64. I have Postgres in my PATH, so I no longer get ‘the local psql could not be located’. However, it still does not work for me. Here is my output:
$ PGUSER=postgres PGPASSWORD=password heroku pg:push baillee HEROKU_POSTGRESQL_
MAROON_URL —app myapp
Password:
pg_dump: reading schemas
pg_dump: reading user-defined tables
…etc…
pg_dump: saving database definition
pg_restore: [archiver] did not find magic string in file header
pg_dump: [custom archiver] could not write to output file: Invalid argument
I just read your post on SO http://stackoverflow.com/questions/25870388/heroku-pgpull-failing-to-populate-schema. Surely there are other people on Windows who have successfully uploaded a database to Heroku. How are they doing it? Clearly I can’t stay on Heroku if I can’t use my database.
I googled gen_pg_*_commands and got nothing. This post http://www.postgresql.org/message-id/4CE6C95F.7090001@gmail.com says use psql, and not pg_restore, but that failed for me because I have to retype that long password by hand — assuming it is the right password.
$ pg_restore -d baillee > HEROKU_POSTGRESQL_MAGENTA just sits there and blinks at me.
Please advise. Thanks.
Copy link
Contributor
Author
I just read your post on SO http://stackoverflow.com/questions/25870388/heroku-pgpull-failing-to-populate-schema. Surely there are other people on Windows who have successfully uploaded a database to Heroku. How are they doing it? Clearly I can’t stay on Heroku if I can’t use my database.
Yes, you can upload a database, you just can’t use the heroku command to do it.
$ pg_restore -d baillee > HEROKU_POSTGRESQL_MAGENTA just sits there and blinks at me.
Please advise. Thanks.
you need to look at the full url with heroku config
of the database and first use pg_dump
to take a dump of your local database, and then PG_PASSWORD=<PASSWORD> pg_restore --verbose --clean --no-acl --no-owner -h <HOST> -U <USER> -d <DB> -p <PORT> <DUMPFILE>
if you want to restore a local dump to heroku
I could not get Git Bash to accept these commands. It kept saying «pg_dump:
too many command-line arguments (first is «-f»)» Is this a Windows issue?
But uploading to Dropbox and then restoring from there worked, so it is
there without all the flags. Now I have an import error so until that is
resolved I don’t really know what I have for a db. Thx.
On Mon, Mar 16, 2015 at 2:07 PM, Will Leinweber notifications@github.com
wrote:
I just read your post on SO
http://stackoverflow.com/questions/25870388/heroku-pgpull-failing-to-populate-schema.
Surely there are other people on Windows who have successfully uploaded a
database to Heroku. How are they doing it? Clearly I can’t stay on Heroku
if I can’t use my database.
Yes, you can upload a database, you just can’t use the heroku command to
do it.$ pg_restore -d baillee > HEROKU_POSTGRESQL_MAGENTA just sits there and
blinks at me.
Please advise. Thanks.
you need to look at the full url with heroku config of the database and
first use pg_dump to take a dump of your local database, and then PG_PASSWORD=
pg_restore —verbose —clean —no-acl —no-owner -h -U -d
-p if you want to restore a local dump to heroku—
Reply to this email directly or view it on GitHub
#334 (comment).
thx stprior and MrSwitch with your solutions it worked