Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (2.6k points)
I´m trying to create a data base from command line. My OS is centos and postgres version is 10.9.

sudo -u postgres psql createdb test

Password for user test:

Why asking me by user?

1 Answer

0 votes
by (7.2k points)

To create a Command-line in MySql you need to do some steps.

First, you need to change the user to Postgres :

su - Postgres

Then create User for Postgres

$ createuser testuser

Create Database

$ createdb testdb

Access the postgres Shell

psql ( enter the password for postgresql)

Provide the privileges to the postgres user

$ alter user testuser with encrypted password 'intellipaat';

$ grant all privileges on database testdb to testuser;

Related questions

0 votes
1 answer
asked Feb 12, 2021 in SQL by adhiraj (4k points)
0 votes
2 answers
0 votes
1 answer
asked Dec 6, 2020 in SQL by Appu (6.1k points)
0 votes
1 answer
0 votes
1 answer

Browse Categories

...