I will show you how to create a database by using a superuser. When we use any type of framework, we need to connect with the database by using a DB name. Table creation, query, and another task can be done by the framework.
Letβs assume you are using Linux Ubuntu and PostgreSQL already install in your pc.you can install PostgreSQL using this link.
Start the PostgreSQL server
sudo service postgresql start
open terminal to enter into PostgreSQL database
sudo su -l postgres
Now create user gias as a superuser, and assign a password immediately
postgres@gias ~ $
createuser -P -s -e gias
Enter password for new role: xyzzy
Enter it again: xyzzy
CREATE ROLE joe PASSWORD 'md5b5f5ba1a423792b526f799ae4eb3d59e' SUPERUSER CREATEDB CREATEROLE INHERIT LOGIN;
Create a database using this command createdb -O user dbname
createdb -O gias testdb
enter into your database
psql -d testdb
show all table name
\dt
Done, you can use your database name and username.
Thank you for reading my article! If you enjoyed it and would like to support my work, please consider buying me a coffee at Buy Me a Coffee. You can also learn more about me and my work by visiting my Giasuddin Bio and following me on LinkedIn and Twitter. Thank you for your support!
Top comments (0)