I've followed some questions for uninstalling postgres sql on mac and can't figure out how to deal with not being able to delete the data directory. My issue is I installed it a while back but don't remember the password and the thinking is to uninstall it unless someone can tell me how to reset the password. I see a mac user account for postgres was created and after resetting the password through mac preferences I sill cannot get access to the db or connect via JDBC. Please help!
You can't access your db as system user is not the same user as user in postgresql.
It is hard to tell where is data directory, while not knowing how you have installed it in first place. It is possible that you have PGDATA environment variable set. You can check it by running following command in the console:
echo $PGDATA
If it is empty you can check possible data directory locations i.e. with find command:
sudo find / -name PG_VERSION
It is file that should be in postgresql database directory according to postgres documentation:
http://www.postgresql.org/docs/8.4/static/storage-file-layout.html
You can also check this answer, if you don't want to uninstall and remove data directory: How do I reset the postgresql 9.2 default user (usually 'postgres') password on mac os x 10.8.2?
Related
For months now, a ruby (sinatra) app "foo.rb" on my dev't Mac has been using a remote Heroku-hosted Postgres database.
The app does not use ANY local database, neither in development nor production.
For another project, I installed Postgress.app from Heroku, first removing a very OLD version as recommended, using brew remove postgresql
The next time I ran foo.rb, and tried at access the (remote) database with SomeModel.count, I get the error:
PG::ConnectionBad: FATAL: no pg_hba.conf entry for host , user , database , SSL off
I'm confused why the error shows my devt machine address when the database connection config points to a remote postgres url, and why it says SSL off.
Any thoughts how to get rid of the error? Is there any way to see the PATH to the pg_hba.conf it is complaining about, so I can verify it contains the correct host entries?
(I wonder if the pg gem has its own copy squirreled away somewhere.)
The copies of pg_hba.conf that I can find (in /Library/Application Support/XXXX for both the old and new Postgress.app versions) have the correct (and unchanged) host entries.
It looks like your script is trying to connect somewhere that is not properly configured
Things to check in that case:
your database.yml or connection string, DATABASE_URL matches your localhost from postgres.app
is your postgres.app is running and have a db server running (check the elephant icon on the top bar of your osx)
You installed and configured properly the postgres app you need to set the path, you can check by typing psql in a new terminal window, if it runs is ok to go.
Configure your $PATH to use the included command line tools (optional):
sudo mkdir -p /etc/paths.d &&
echo /Applications/Postgres.app/Contents/Versions/latest/bin | sudo tee /etc/paths.d/postgresapp
post your file or part of it in the question, it helps a lot to debug :)
The answer turned out to be:
comment out pg in Gemfile
bundle install
replace pg
bundle install
I suspect when the gem pg is installed, it dynamically establishes some link to postgresql, so if you move postgresql (as I did when I installed Postgres.app) you need to remove the pg gem then re-add it.
I am running MacOS Mojave 10.14 with XAMPP 7.2.5
Earlier today, I tried to start up XAMPP after a crash/restart. XAMPP Manager was unable to start the MYSQL Server. Apache did start correctly.
Figuring there was a potential corruption, I used my Time Machine to restore my XAMPP folder (to a 36-hour old file) in Applications.
Now when I try to run XAMPP Manager, I get a "Cannot find any readable ctl script" error message.
I've tried to run MYSQL Server directly from CLI. I receive the following message:
./mysql.server: line 200: my_print_defaults: command not found
Starting MariaDB
ERROR! Couldn't find MariaDB server (/Applications/XAMPP/xamppfiles/bin/mysqld_safe)
Any thoughts on how to resolve?
The issue has to do with a quirk with Time Machine - it does not completely regenerate all recorded folders/files. A bit of a pain.
I was able to run XAMPP from the command line:
-> cd /Applications/xampp/xamppfiles
-> sudo ./xampp start
To check on MYSQL status:
-> mysql status -u [username] -p [password]
Issue resolved
I spend a day on this and the solution in my case was:
Uninstall XAMPP
Delete all files except my databases folders from Applications/XAMPP/xamppfiles/var/mysql (there was some .err and log files if I remember well)
Reinstall XAMPP
Reconfigure it. If you use different user than root to access your databases you need to recreate it.
I got the "Cannot find any readable ctl script" error after a Time Machine restoration, too. I'm on 10.12.6 and XAMPP 5.6.
You are correct that it appears to be a TM issue, but I was able to resolve it by entering TM and specifically selecting the directories in XAMPP/xamppfiles/ that TM would not copy over by just selecting XAMPP/xamppfiles/. (In your case, you would not want to copy over /var/mysql, assuming you want to keep your data.)
Relief. There's nothing worse than realizing your trusty backup is not so trusty.
I got a new mac today and ran the migration assistant which worked great for most things, however I can't seem to get into psql now.
postgres is installed with homebrew and the service starts fine, however whenever I run 'psql postgres' now I get the following error:
psql: FATAL: role "Jamie" does not exist
Jamie being my actual account name for the user on my mac. This was all working/running absolutely fine on my old mac...
Well, local account name was different what was showing based on my old mac configuration. Painful. Changed to connect to psql with different user and it worked fine.
I'm having some trouble installing Canopy on my Mac OS X (running 10.9.5) under my primary username. I get to the point where it asks for the location for the Canopy Environment Directory, but when I hit Continue, it crashes. I have been able to install it on the same computer, using my secondary username, but switching between the two usernames is less than ideal. Would love any suggestions. I already tried removing admin status from the secondary username to see if that changed anything, but it did not.
Thanks to anyone who has suggestions!
Any chance that this is relevant? https://support.enthought.com/entries/23707691-Canopy-GUI-requires-extra-setup-steps-when-user-s-home-path-contains-non-ASCII-characters
I actually had the same problem on my Mac. For me, I resolved it by changing the ownership of my home directory:
Open Terminal
Type in the following commands (hit enter after every line):
cd ~
cd ..
sudo chown <your_username> <your_directory>
replace <your_username> with your username, and <your_directory> with the directory in which all your personal files are stored
The last command may ask for a password. If it does, enter your password and hit Enter.
My goal is to have a Postgres setup that I can use to develop my rails app and then push it to Heroku without having to change the database config file. Seems simple enough, right?
I've seen plenty of things on the internet about PostgreSQL 9.2.x not running on OS X 10.8, and I'm still struggling to get it working with Rails. Not realizing that a version of PSQL shipped with OS X, I set out to install it. (NOTE: I'm sort of debugging in circles, so things may not have worked as I expected.)
I've tried downloading and installing using the official graphical installer listed here, and I rebooted my Mac. I saw an extra user account was created, and I promptly deleted it. (I know, I know, probably what caused some heartache down the line, but it didn't seem reasonable to have an extra user account sitting around.)
Upon running my rails app, it couldn't connect to postgres. I tried running psql from Terminal.
psql: 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 then proceeded to install Postgres with homebrew. I installed homebrew, then postgres. Same thing. I googled a bit and ran into a thread on the Postgres forum. What I got from it was that something changed between OS X 10.7 and 10.8, but that wasn't the cause of my problem.
Next, I tried using self-contained the Postgres.app. Now, I was able to create users and connect to the database. Rails was able to connect to Postgres, but complained that the database that I defined in config.yaml was absent. So I created it - or so I thought.
Running CREATE DATABASE my_db in the "self-contained" version of PSQL didn't work - even though without the self contained app, PSQL would have that socket error. I then tried creating a new user with write access. Nope. The CREATE was silently failing.
I tried adding localhost to my environment variable and it seemed to have solved the port error - but now Rails was having trouble finding Postgres again.
I uninstalled the brew version. I removed the enterprise tools et al. Still no luck. Reboot. Still no luck.
I just uninstalled brew and my config looks like this:
development:
adapter: postgresql
database: my_db
pool: 5
timeout: 5000
host: localhost
port: 5432
Rails says the database doesn't exist.
What do I need to do to get Postgres working with Rails 3.2.6 on Mac OS X 10.8.4 Mountain Lion?
There are a lot of ways of getting to the point you want, but this should work:
First - get rid of any existing copies of PostgreSql as follows:
brew update
brew uninstall postgresql
(assuming no probs with brew update)
I found this removed the instance that ships with osx 10.8
If you still have the Postgres App, drag it out of Applications and into Trash
I would then do a restart, just for the hell of it... (my old Windows experience :-)
Then install the latest postgres (or u can prob specify a version here)
brew install postgres
If it throws up an error relating to something like ossd-uuid, then just do a
brew uninstall ossd-uuid && brew install ossd-uuid
and that should clear it
The homebrew lists some useful commands, eg set postgres to launch on startup etc
Create an initial postgres db by
initdb /usr/local/var/postgres -E utf8
the start postgres by
postgres -D /usr/local/var/postgres
Now at your terminal prompt, type
psql postgres
using your Mac admin password, u should get a prompt thus (\q exits):
postgres=#
A user with your username will have been created (but, from memory, not a password for it) so set that now
postgres=# alter user your-name with password 'anything';
It will return with ALTER ROLE if successful (& just the prompt if not)
Then, if your Rails database is eg dev_db, u can create a user for that thus:
postgres=# create role your_user with login createdb createrole password 'your_pass';
your_user and your_pass will appear in your rails database.yaml file (not sure if createdb & createrole NEED to be there, but thats what I did)
Finally, your database.yaml needs to have development like:
development:
adapter: postgresql
encoding: unicode
database: dev_db
pool: 5
timeout: 5000
host: localhost
username: your_user
password: your_pass
Then
rake db:create
And that should create an empty database that your Rails migrations will populate
I hope :-)