I've installed the Windows version of Postgres, as explained in the instructions here, and when I try to call heroku pg:psql, I get an error saying The local psql command could not be located. I've tried installing Postgres inside my app directory, but that hasn't worked.
Have you tried this suggested solutions?
The local psql command could not be located
The problem was a difference between the version of postgres on heroku compared to the local version. Try running heroku pg:info and compare it to postgres --version
Related
I am trying to shift from heroku to amazon aws and after I dumped the db using:
heroku pg:backups:capture
heroku pg:backups:download
I ran:
eb ssh
cd /var/app/current
pg_restore -v -h $NAME.$ID.$DATACENTER.rds.amazonaws.com -U $RDS_ROOT_USER -d $DATABASE_NAME latest.dump
I get the following error:
pg_restore: [archiver] unsupported version (1.13) in file header
BTW I am using rails.
What am I doing wrong?
You're using an old version of pg_restore binary that doesn't support restoring the provided dump file. Please make sure that you use the latest Postgres version, which must be higher than the following release: https://www.postgresql.org/about/news/1834/ (10.3, 9.6.8, 9.5.12, 9.4.17, and 9.3.22).
You can check the pg_restore version you're using by running pg_restore --version.
If you are using a third-party tool, such as PgAdmin, to restore the provided dump file, the restore may not succeed even with the installed Postgres version being up to date. This is due to third-party tools often bundling their own versions of the pg_restore binary, that may not be up to date.
Follow this link: Why am I getting pg_restore
Gotten to databases portion of deploying C9 to heroku but I keep running int othis error. Postgresql is already installed on cloud9 but I'm having trouble. I get this error when I run "postgresql" into terminal
ryanreese09#codefund:~/workspace/ruby-getting-started (master) $ psql
ry Is the server running locally and accepting connections on Unix
domain socket "/var/run/postgresql/.s.PGSQL.5432"?
https://devcenter.heroku.com/articles/getting-started-with-ruby#declare-app-dependencies
I haven't run bundle install since the postgresql command didn't work. It's not running. Would anyone be willing to getthrown on my workspace as a member and help? I've been messing with this all weekend. All the various threads I've search on here don't quite help. The don't help with getting the sockets set up. Please don't flame. I'm new.
EDIT- Ruby on Rails: How can i edit database.yml for postgresql?
Changed my database.yml file but literally nothing changed. So I reverted it back to the default database.yml file for now (that came with installation)
$ sudo service postgresql start
I'm not sure what has happened to my heroku postgres but when I try to access it with command line with pg:info and pg:psql, I get "Not found".
I even clicked on the button on heroku to create a database for my app as well.
How do I debug this? What can I try? I don't mind starting from scratch since it's for testing.
It wants the psql installed and avalibale on the command line on your local machine. On Ubuntu, I ran sudo apt-get install postgresql-client . heroku pg:psql then worked straight away.
Try passing the appname or database name explicitly. The heroku cli tries to infer your application name from the 'heroku' git remote but if it can't find that it just returns the Not Found message.
eg;
heroku pg:info --app appname
If you are one OS X you should install postgres like this :
brew install postgres
See this. May be the same reason.
Heroku postgres not found
Attempting to get Rails running with postgresql on mac osx 10.8 to deploy to heroku. I'm new to mac's.
Had lots of trouble just getting PostgrSQL installed so I could have botched up something trying all the potential solutions I could find searching on that subject. Which mainly appeared to be permissions and existing OSX installation. for this issue I'm noticing some things that make me think there is some fundamental directory or version conflict that I'm not sure how to resolve yet. But I could be wrong and it is something else! Any direction is appreciated.
retrieving an error such as this:
$ rake db:create:all
could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
I'm not sure where and why it's looking for the var directory but ~/var appears to be a link (alias) to /private/var (which has empty pgsql_socket & pgsql_socket_alt directories), /usr/local/var doesn't have pgsql_socket directory but does have a postgres directory. both of those directories my admin user has read & write permission from the finder get info dialog.
The above error shown is followed by a long stack in the gems 1.8 directory and finishes with this:
Couldn't create database for {"pool"=>5, "database"=>"blog_development", "password"=>nil, "username"=>"USERNAME", "encoding"=>"unicode", "adapter"=>"postgresql"}
so checking:
$ which psql
/usr/bin/psql
i do remember after installing postgresql i did this:
initdb /usr/local/var/postgres -E utf8
Confirmed:
$ ps aux | grep postgres
username 346 0.0 0.1 2479616 7724 ?? S 3:08PM 0:00.03 /usr/local/bin/postgres -D /usr/local/var/postgres -r /usr/local/var/postgres/server.log
bundle show yields: pg (0.14.1)
$ postgres --version
postgres (PostgreSQL) 9.2.1
echo $PATH does not show any reference to posgresql.
this app is in a /Users/USERNAME/SUBDIR/APP.
Andy ideas on where i've messed up and how i can get this stuff up and running? I'd appreciate any direction. I'll keep working through stack overflow and google discussions; although my stupidity may be unique!
Thanks.
Add
host: localhost
to database.yml
I am running rake db:setup on my server, and I am getting:
Can't connect to local MySQL server through socket '/tmp/mysql.sock'
(I added RAILS_ENV=production)
This is on a ubuntu, nginx, passenger, mysql setup.
Either MySQL isn't running, or it's not configured to put the sock-file in the right place. Run something like ps aux | grep mysql to check if it's running. If it's running and the error persists, check if the file /tmp/mysql.sock exists. You can configure it in /etc/mysql/my.cnf
On my ubuntu machine its configured to /var/run/mysqld/mysqld.sock. Either change your mysql settings, or change config/database.yml in your Rails app.
I had this issue and after trying everything I discovered that this occurs if you install mysql after you have installed rails.
Reinstalling rails solved the issue for me.
Of course this advice is only relevant if iain's answer doesn't solve your issue ;-)
If you dont have the file /tmp/mysql.sock, create a symlink to the actual socket file. You will have to locate it first, but mine was here:
/etc/mysql/my.cnf
That should fix it, as long as mysql is actually installed and running, check using this:
ps aux | grep mysql
I changed the sockets in /etc/mysql/my.cnf, then it worked fine.