简体   繁体   中英

Can't stop automatic PostgreSQL start-up on WSL Ubuntu terminal open

I'm starting my coding journey and I have set up the Ubuntu terminal(WSL2). I followed this guide my cousin gave me and it included some directions to install PostgreSQL. I thought it would be a good idea to get it ahead of time, but now it's turning into a nightmare. I installed it and followed the directions to make it automatically connect to the server on the Ubuntu terminal start-up. Long story short, it makes the terminal take awhile to start-up, puts my terminal in some weird directory, and I won't even be using it, so we decided to get rid of it. We tried everything and finally decided to just uninstall it. Now on start-up, it's still trying to connect to the server or whatever. I tried running the code to make it automatically start-up again in case it might just toggle it on and off, but now it's attempting to connect three times on open. Please see the directions I used below as well as what my terminal is showing on start-up. Also, when I try commands to end it or whatever, it can't do it because postgresql can't be found (because I uninstalled it). Any thoughts?

Directions: In a few weeks, we'll talk about SQL and Databases and you'll need something called PostgreSQL, an open-source robust and production-ready database.

Let's install it now.

sudo apt install -y postgresql postgresql-contrib libpq-dev build-essential
sudo /etc/init.d/postgresql start
sudo -u postgres psql --command "CREATE ROLE `whoami` LOGIN createdb;"

You can configure PostgreSQL to autostart, so you don't have to execute sudo /etc/init.d/postgresql start each time you open a new terminal:

sudo echo "`whoami` ALL=NOPASSWD:/etc/init.d/postgresql start" | sudo tee /etc/sudoers.d/postgresql
sudo chmod 440 /etc/sudoers.d/postgresql
echo "sudo /etc/init.d/postgresql start" >> ~/.zshrc

Error Code:

sudo: /etc/init.d/postgresql: command not found
sudo: /etc/init.d/postgresql: command not found
sudo: /etc/init.d/postgresql: command not found
➜  /home

Just remove the offending line from .zshrc .

Let me add that the Linux emulation of Windows cannot be used for serious work with a database, as it does not implement the vital system call fsync to persist data. Any operating system crash will result in data corruption.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM