QSqlDatabasePrivate::database: unable to open database
-
I'm getting the following error when trying to run a qt project:
QSqlDatabasePrivate::database: unable to open database: "could not connect to server: Permission denied
Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?Now I was also getting this error when trying to log into postgresql but I resolved that issue using this post:
http://stackoverflow.com/questions/6770649/repairing-postgresql-after-upgrading-to-osx-10-7-lion
Once I added export PATH=/usr/local/bin:$PATH
to the end of my .bash_profile on my mac lion, then I was able to log into postgresql:unknown045453009c92:.XKGateway johnmerlino$ psql -d db_development -U johnmerlino
psql (9.1.2)
Type "help" for help.xkdb_development=#
However, even after that, still when I try to run the qt project, I get the error message and the database.json file it references contains the right database and username.
-
I think you've to call "QSqlDatabase":https://qt-project.org/doc/qt-5.0/qtsql/qsqldatabase.html instead of QSqlDatabasePrivate
-
make sure you have execute permissions on the following folders:
- /var
- /var/pgsql_socket
A quick look up in the internet stated that you may also have to update your postgresql.conf and uncomment a line there to set the file permissions to 0777.