第一步:下载 Postgres.app with PostgreSQL 9.5 – 13
访问 https://postgresapp.com/downloads_legacy.html 下载 Postgres.app v2.4.4
第二步:移动到应用程序 Applications ➜ 双击运行
第三步:点击 'Initialize' 按钮初始化数据库
第四步:配置 PATH 路径
sudo mkdir -p /etc/paths.d &&
echo /Applications/Postgres.app/Contents/Versions/latest/bin | sudo tee /etc/paths.d/postgresapp
# Done! You now have a PostgreSQL server running on your Mac with these default settings:
# Host localhost
# Port 5432
# User your system user name
# Database same as user
# Password none
# Connection URL postgresql://localhost
第五步:修改密码
ALTER USER postgres WITH PASSWORD '需要设置的密码'
第六步:用密码登录
psql -U postgres -W
安装Mysql
// brew 安装 mysql
brew install mysql
// 启动 mysql
brew services start mysql
// 设置密码
mysql_secure_installation
// 登录数据库
mysql -u root -p