Search code examples
postgresqlubuntuvagrant

psql: FATAL: role "vagrant" does not exist


I have been trying to set up vagrant but I am getting this error. I will list out my installation method. Please suggest changes where you feel they are needed.

-Installed virtual box
sudo apt-get install virtual box

-Downloaded .deb package from vagrant website

-Installed it using
sudo dpkg -i (package_name)

-then I selected the vagrant folder in the fullstack folder and
vagrant up
vagrant ssh

then I did :
vagrant@vagrant-ubuntu-trusty-32: cd /vagrant/forum vagrant@vagrant-ubuntu-trusty-32:/vagrant/forum$ sudo apt-get install postgresql-client-common vagrant@vagrant-ubuntu-trusty-32:/vagrant/forum$ sudo apt-get install postgres-xc-client

Then finally:
vagrant@vagrant-ubuntu-trusty-32:/vagrant/forum$ psql psql: FATAL: role "vagrant" does not exist


Solution

  • You need to change to the postgres user and give vagrant superuser access.

    sudo su - postgres
    createuser vagrant -s
    exit  # exit from postgres user back into vagrant
    

    You can do everything with with vagrant now.