Skip to content

Instantly share code, notes, and snippets.

@weizhicheng
Created July 11, 2014 19:15
Show Gist options
  • Save weizhicheng/3c57dd4fd7cb475e1bab to your computer and use it in GitHub Desktop.
Save weizhicheng/3c57dd4fd7cb475e1bab to your computer and use it in GitHub Desktop.
重新安装数据库发现的问题
这两天开发的时候总是遇到数据库的问题,可能是我以前没学扎实,重新再安装一次postgresql,发现了如下问题:
这是老师的运行结果
limingth@gmail ~/Github/myRoR$ ls /Applications/Postgres93.app/Contents/MacOS/bin/
clusterdb gdalsrsinfo pg_receivexlog
createdb gdaltindex pg_resetxlog
createlang gdaltransform pg_restore
createuser gdalwarp pg_standby
cs2cs geod pg_test_fsync
dropdb initdb pg_test_timing
droplang invgeod pg_upgrade
dropuser invproj pgbench
ecpg nad2bin pgsql2shp
gdal_contour nearblack postgres
gdal_grid ogr2ogr postmaster
gdal_rasterize ogrinfo proj
gdal_translate ogrtindex psql
gdaladdo oid2name raster2pgsql
gdalbuildvrt pg_archivecleanup reindexdb
gdaldem pg_basebackup shp2pgsql
gdalenhance pg_config testepsg
gdalinfo pg_controldata vacuumdb
gdallocationinfo pg_ctl vacuumlo
gdalmanage pg_dump
gdalserver pg_dumpall
limingth@gmail ~/Github/myRoR$ export PATH="/Applications/Postgres93.app/Contents/MacOS/bin:$PATH"
这是我用同样的命令实现的结果
zhichengs-MacBook-Air:wikiful zhichengwei$ ls /Applications/Postgres.app/Contents/MacOS/bin/
ls: /Applications/Postgres.app/Contents/MacOS/bin/: No such file or directory
zhichengs-MacBook-Air:wikiful zhichengwei$ ls /Applications/Postgres.app/Contents/MacOS/
Postgres
zhichengs-MacBook-Air:wikiful zhichengwei$ export PATH="/Applications/Postgres93.app/Contents/MacOS/bin:$PATH"
zhichengs-MacBook-Air:wikiful zhichengwei$
我的问题是:
刚刚安装好的postgresql是不是没有bin文件?为什么我没有找到老师你看到的那么多文件?
export PATH="/Applications/Postgres93.app/Contents/MacOS/bin:$PATH"对于添加路径这一步我很不理解,希望老师帮我解释一下
@limingth
Copy link

/Applications/Postgres.app/Contents/MacOS/bin/ 是 psql 命令可执行文件所在的路径。

export 是把这个路径添加到 $PATH 环境变量里面,这样系统可以自动找到。

我看到你运行 ls /Applications/Postgres.app/Contents/MacOS/bin/ 是 No such file or directory

应该是安装路径没写对,/Applications/Postgres93.app/Contents/MacOS/bin 留意是 93

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment