Cannot enter the database within Postgresql.

Asked 2 years ago, Updated 2 years ago, 82 views

https://github.com/blobmon/simplechan
I want to enter the database as a user, but I can't.

Now, once you are back again being the normal, default user, cd into /sql/ directory in Simplechan repository.We are going to create tables and functions now.
Try opening psql with the latest created db and role.In my default case, I try opening psql with simplech_db and simplech_role.

$psql-d simplech_db-U simplech_role

Create tables by importing these sql files now.Type these commands...

\icreate_table_query.sql
\ifunctions.sql
\ifunctions_moderator.sql

Make sure these sql statements were imported and executed without errors.If there are errors, make sure to fix them.I think an error light come when you type \i create_table_query.sql with extension uuid-ossessential errors.By attempting

I can't do individual parts.I would like to enter the database from the user, create a table, and create an sql file, so please let me know the procedure.
"By the way, ""simplech_db and simplech_role."""← Does this work on Linux in virtualbox?Or is it done on SQL Shell?

linux sql postgresql virtualbox

2022-09-30 21:31

1 Answers

I think the first section of the quoted README.md contains the instructions.

Install postgresql database server in your machine. Make sure it is version 9.5 or great.

After installing postgresql, open command line and enter these commands line-by-line making sure you are doing correctly every time... This command is for opening psql with default postgres user. Just typing psql while being normal user will fail because postgres user requires postgres db to open. It is extra step which postgresql people might have avoided. But it is needed for security I think.

$sudo su-postgres
$psql

Once you are inside psql, create a role and a database with your desired name.In default case, I have used simplech_role and simplech_db for role and database name inspectively.Type these commands...

CREATE ROLE simplech_role WITH SUPERUSER CREATEDB LOGIN;
CREATE DB simplech_db WITHOWNER simplech_role;

So with PostgreSQL 9.5 or higher installed,

  • From the Linux shell, run sudo and psql.
  • Run create ROLE and CREATE DB from the
  • psql prompt.

Then you can execute the quoted command.

Add

Checked the database creation procedure in PostgreSQL 9.5.
create DB appears to be a syntax error.(There seems to be no abbreviation)

create database simplech_db WITHOWNER simple_role;

It appears that you need to be executed.

Therefore, the database creation may have failed, and the psql-d simplech_db-U simplech_role may have failed.
You can see if database simplech_db is working in psql-l.

$sudo su-postgres
$psql-l

If possible, you will see simplech_db in the output.


2022-09-30 21:31

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.