# postgres-sql-learn **Repository Path**: ggggxiaolong/postgres-sql-learn ## Basic Information - **Project Name**: postgres-sql-learn - **Description**: 学习PG数据库,中文文档的sql练习 - **Primary Language**: SQL - **License**: MIT - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2022-04-28 - **Last Updated**: 2023-11-10 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README [中文翻译地址](http://http://www.postgres.cn/docs/14/index.html) 1. 安装数据库 ```shell # pacman -S postgresql ``` 2. 初始化数据库 ```shell $ sudo -iu postgres initdb -D /var/lib/postgres/data ``` 3. 启动服务 ```shell sudo systemctl start postgresql ``` 4. 创建用户并授权 ```sql sudo su postgres # 进入数据库 psql # 创建用户 create user 'mrtan' with password 'mrtan'; # 创建数据库 create database mrtan; # 分配权限 grant all on database mrtan to mrtan ; ```