brew services stop postgresql
brew postgresql-upgrade-database
brew services start postgresql
- 旧数据库存放位置
/usr/local/var/postgres
- psql 位置:
/usr/local/Cellar/postgresql
brew install postgresql
brew postgresql-upgrade-database
执行此命令要保证旧数据库存放位置正确
psql postgres
运行psql
\list or \l: list all databases
\c <db name>: connect to a certain database
\dt: list all tables in the current database using your search_path
\dt *.: list all tables in the current database regardless your search_path