#posgresql
#posgresql
docker run --name postgres -e POSTGRES_PASSWORD=mysecretpassword -e POSTGRES_USER=test -p 5432:5432 \
-e PGDATA=/var/lib/postgresql/data/pgdata \
-e POSTGRES_DB=foo \
-v /home/code/Desktop/postgres/data:/var/lib/postgresql/data/pgdata postgres
#进入continer 创建用户
docker exec -it pg
` sudo -i -u postgres `或者 ` su postgres ` 切换倒psql
`psql -h localhost -d foo -U test -p 5432 ` 进入psql 控制台
创建用户
createuser --interactive
#修改密码
alter user hello with password '123456';
GRANT ALL PRIVILEGES ON DATABASE hello TO hello;
Last active
August 21, 2021 04:39
-
-
Save dtest11/0aa90bc0117fe0491ca1e977a847097f to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
test