termux安装和配置postgresql和mysql
2023-06-13 09:17:26 时间
mysql:
#安装
apt install mariadb
#打开一个新窗口运行mysql服务
mysqld &
#切换回当前窗口,初始化数据库,设置密码
mariadb-secure-installation
#登录测试
mysql -uroot -p你的密码
pgsql:
#安装
apt install postgresql
#创建指定的数据库目录
mkdir $PREFIX/var/lib/postgresql
#初始化数据库
initdb $PREFIX/var/lib/postgresql
#启动数据库服务
pg_ctl -D $PREFIX/var/lib/postgresql -l logfile start
#启动客户端测试
psql -d postgres
centos7安装pgsql12
执行 : yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm -y 2:安装postgres
- 更新源
yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm -y
- 安装 先查看postgresql源
yum list | grep postgresql
如果能找到,再执行安装
yum install postgresql12-contrib postgresql12-server -y
- 初始化数据库
/usr/pgsql-12/bin/postgresql-12-setup initdb
- 设置开机启动
sudo systemctl start postgresql-12
sudo systemctl enable postgresql-12.service
- 登录postgresql并设置密码 postgresql在安装时默认添加用户postgres 设置密码
alter user postgres with password '123456';
- 设置外网访问,修改两个配置文件
# 1.pg_hba.conf
vim /var/lib/pgsql/12/data/pg_hba.conf
# 文件末尾加入
host all all ::1/128 md5
# 2.postgresql.conf
# listen_addresses = 'localhost'
# 修改为listen_addresses = '*'来
- 重启pgsql systemctl restart postgresql-12
pgsql用户基本
创建数据库
CREATE DATABASE testdb;
创建用户
CREATE USER testuser CREATEDB LOGIN PASSWORD 'testpassword';
将testdb所有权限赋给用户testuser
GRANT ALL ON DATABASE testdb TO testuser;
删除数据库
drop database testdb;
删除用户
drop role testuser;
相关文章
- ?MySQL安装目录:找到它!(mysql安装目录在哪)
- 安装MySQL的Chroot安装:跨界自由飞翔(mysql的chroot)
- 安装Zip版MySQL: 走上正确的路(安装zip版mysql)
- MySQL服务器安装指南(如何安装mysql服务器)
- 密码如何快速重置MySQL密码(重置mysql)
- MySQL 时间据类型深度解析(mysql时间的数据类型)
- 快速掌握JS操作MySQL数据库技巧(js操作mysql数据库)
- MySQL数据库连接器:构建强大数据库连接。(mysql数据库连接器)
- MySQL:配置远程访问权限(mysql配置远程访问)
- MySQL回滚操作的失败案例(mysql回滚失败)
- 配置MySQL主从一个库配置实现方案(mysql主从一个库)
- MySQL 1130连接配置指南(mysql连接1130)
- 里在哪里安装MySQL数据库?(mysql装在哪)
- 里MySQL安装使用指南(mysql装在哪)
- MySQL配置:优化内存使用(mysql配置内存)
- 如何快速配置MySQL本地连接(mysql本地连接)
- PL/SQL如何配置MySQL数据库(plsql配置mysql)
- 一步步指引,学会64位Mysql安装(64位mysql安装教程)
- MySQL主从同步配置实践指南(2.mysql的主从配置)
- MySQL二者择其一,两种安装方式(mysql 两种安装方式)
- MySQL安装后无法启动的问题解决方法(mysql下载好打不开)
- MySQL下载安装问题解决方法大揭密(mysql下载后无法安装)
- MySQL数据迁移迁移到C盘后应该注意什么(mysql下到了c盘)
- 解决MySQL配置问题的方法(mysql 不能配置)
- 解决MySQL无法输入中文问题的方法(mysql 不能输中文)