-
Notifications
You must be signed in to change notification settings - Fork 16
Alpine内安装、配置一个轻量的数据库
cooip-jm edited this page Aug 10, 2024
·
1 revision
###############
安装postgresql数据库
#############
apk add wget
wget -O - https://raw.githubusercontent.com/cooip-jm/About-openwrt/main/alpine-bash.sh | sh -s -- -v
apk add postgresql
rc-service postgresql start
rc-service postgresql status
rc-update add postgresql
nano /etc/postgresql/postgresql.conf ####修改监听 listen_addresses = '*' # 改为*
nano /etc/postgresql/pg_hba.conf ###配置允许访问范围 host all all 0.0.0.0/0 md5 # 新增这行
rc-service postgresql restart
-- 登录
psql -U postgres
-- 创建用户
CREATE USER myuser WITH PASSWORD 'mypassword';
-- 创建数据库
CREATE DATABASE mydb OWNER myuser;
-- 授予权限
GRANT ALL PRIVILEGES ON DATABASE mydb TO myuser;
-- 退出
\q