[LINUX] [PostgreSQL] How to grant superuser authority when the user (role) with superuser authority is 0

I will leave it as a memo.

manner

I write postgres10 as a prerequisite. Basically, you can do it by changing the path including the version described later. It also assumes that the default user is postgres.

Stop postgres.

sudo service postgresql stop

2. Start postgres in single user mode

Switch to the postgres user.

sudo su - postgres

Limited launch of postgres

/usr/lib/postgresql/10/bin/postgres --single -D /etc/postgresql/10/main/

3. Grant superuser privileges to any role with sql.

alter user postgres with superuser;
#Ctrl when done+Exit with D.

4. Start postgres.

sudo service postgresql start

that's all.

Recommended Posts

[PostgreSQL] How to grant superuser authority when the user (role) with superuser authority is 0
Change the installation destination when --user is added to pip
How to deal with the problem that the current directory moves when Python is executed from Atom
Ansible role to prevent the initial confirmation message when connecting with SSH
How to automatically notify by phone when the python system is down
How to deal with errors when hitting pip ②
How to specify the NIC to scan with amazon-dash
How to try the friends-of-friends algorithm with pyfof
How to deal with SessionNotCreatedException when using Selenium
How to display in the entire window when setting the background image with tkinter
[AWS] Wordpress How to deal with "The response is not a correct JSON response"
How to Learn Kaldi with the JUST Corpus
How to change the behavior when loading / dumping yaml with PyYAML and its details
When the variable you want to superscript with matplotlib is two or more characters
[Introduction to Python] What is the important "if __name__ =='__main__':" when dealing with modules?
How to delete the specified string with the sed command! !! !!
[Introduction to Python] How to iterate with the range function?
How to create a submenu with the [Blender] plugin
How to get a logged-in user with Django's forms.py
How to disable the reference feature when outputting PyYaml
[Python] How to specify the download location with youtube-dl
How to access with cache when reading_json in pandas
Linux user addition, how to use the useradd command
[Note] How to give sudo authority to user on CentOS
[Python] How to rewrite the table style with python-pptx [python-pptx]
Scraping with Python-Selenium is old! ?? ・ ・ ・ How to use Pyppeteer
How to deal with the terminal getting into the pipenv environment without permission when using pipenv with vscode
How to delete "(base)" that appears in the terminal when Anaconda is installed on Mac
[VLC] How to deal with the problem that it is not in the foreground during playback
I tried to simulate how the infection spreads with Python
How to return to the previous directory with the Bash cd command
How to handle static files when deploying to production with Django
How to not load images when using PhantomJS with Selenium
How to update user information when logging in to Django RemoteUserMiddleware
How to manipulate the DOM in an iframe with Selenium
How to resolve CSRF Protection when using AngularJS with Django
[Linux] How to deal with garbled characters when viewing files
A story about how to deal with the CORS problem
How to get into the python development environment with Vagrant
How to deal with UnicodeDecodeError when executing google image download
The story that the private key is set to 600 with chmod
How to output additional information when logging with python's logging module
[Introduction to Python] How to get data with the listdir function
[Python] What is pip? Explain the command list and how to use it with actual examples
What to do when a part of the background image becomes transparent when the transparent image is combined with Pillow
How to deal with the error "Failed to load module" canberra-gtk-module "that appears when you run OpenCV
How to use the generator
Connect to Postgresql with GO
How to update with SQLAlchemy?
How to cast with Theano
How to Alter with SQLAlchemy?
How to separate strings with','
How to RDP with Fedora31
How to use the decorator
How to Delete with SQLAlchemy?
How to increase the axis
How to start the program
How is the progress? Let's get on with the boom ?? in Python
How to not escape Japanese when dealing with json in python
[Linux] I want to know the date when the user logged in
[Introduction to Python] How to split a character string with the split function