QSqlDatabasePrivate::database: unable to open database
johnmerlino last edited by
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:
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
Type "help" for help.
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.
mbnoimi last edited by
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:
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.