docker run --name retail_pg -e POSTGRES_PASSWORD=mypassword -v /Users/fallout/PycharmProjects/Internal/data_copy/retail_pg:/var/lib/postgresql/data -v /Users/fallout/research/data/retail_db_json:/data -p 5432:5432 postgres
CREATE DATABASE retail_db;
CREATE USER retail_user WITH ENCRYPTED PASSWORD 'something';
GRANT ALL PRIVILEGES ON DATABASE retail_db TO testing;
After which I run:
docker exec -it retail_pg psql -U testing -d retail_db -f /data/create_db_tables_pg.sql
Results in:
psql:/data/create_db_tables_pg.sql:12: ERROR: permission denied for schema public
LINE 1: CREATE TABLE departments (
Any ideas how to fix this?
GRANT ALL PRIVILEGES ON SCHEMA PUBLIC TO user_name;
Above is the solution to fix the issue. @Turing85 answered but there is an error in the syntax.
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.