psql export return 当文件存在时没有那个文件或目录
psql export return No such file or directory when the file exist
我运行
psql -E -U siteportal -d portal -h 172.19.242.32 -c "COPY externals (id,logo_path,favicon_path,cover_path,header,description,sign_enable,sign_text,footer_logo_enable,footer_logo_path,footer_text,created_at,updated_at) FROM '/Applications/MAMP/htdocs/code/site/portal/public/csv/externals.csv' DELIMITER ',' csv;"
我得到了
ERROR: could not open file "/Applications/MAMP/htdocs/code/site/portal/public/csv/externals.csv" for reading: No such file or directory
但我确定文件在那里,因为当我 运行
cat /Applications/MAMP/htdocs/code/site/portal/public/csv/externals.csv
我得到了
1,"/images/account/operator/logo.png","/images/account/operator/favicon.png","/images/account/operator/external.png","site Portal","Log in using your credentials",1,"This is a secure page",1,"/images/account/operator/footer_logo.png","© 2017 site Networks Inc.","2016-12-22 13:37:42","2017-01-31 14:22:11"
是不是权限问题?
-rwxrwxrwx@ 1 site staff 307 May 24 13:46 externals.csv
我什至尝试 chomd 777
和 运行 与 sudo
。但似乎没有任何帮助!
将 copy
更改为 \copy
(https://www.postgresql.org/docs/current/static/app-psql.html#APP-PSQL-META-COMMANDS-COPY)。稍微不同的命令可让您将 to/from 文件复制到您的服务器。
此处不同的原因是因为您正在连接到远程服务器(我假设),但导入的是本地文件。
另一种选择是传递您的文件并让 psql
从标准输入中读取
-c "copy externals (id,logo_path,favicon_path,cover_path,header,description,sign_enable,sign_text,footer_logo_enable,footer_logo_path,footer_text,created_at,updated_at) from STDIN with delimiter as ','" < /Applications/MAMP/htdocs/code/benu/ssc-portal/public/csv/externals.csv
我运行
psql -E -U siteportal -d portal -h 172.19.242.32 -c "COPY externals (id,logo_path,favicon_path,cover_path,header,description,sign_enable,sign_text,footer_logo_enable,footer_logo_path,footer_text,created_at,updated_at) FROM '/Applications/MAMP/htdocs/code/site/portal/public/csv/externals.csv' DELIMITER ',' csv;"
我得到了
ERROR: could not open file "/Applications/MAMP/htdocs/code/site/portal/public/csv/externals.csv" for reading: No such file or directory
但我确定文件在那里,因为当我 运行
cat /Applications/MAMP/htdocs/code/site/portal/public/csv/externals.csv
我得到了
1,"/images/account/operator/logo.png","/images/account/operator/favicon.png","/images/account/operator/external.png","site Portal","Log in using your credentials",1,"This is a secure page",1,"/images/account/operator/footer_logo.png","© 2017 site Networks Inc.","2016-12-22 13:37:42","2017-01-31 14:22:11"
是不是权限问题?
-rwxrwxrwx@ 1 site staff 307 May 24 13:46 externals.csv
我什至尝试 chomd 777
和 运行 与 sudo
。但似乎没有任何帮助!
将 copy
更改为 \copy
(https://www.postgresql.org/docs/current/static/app-psql.html#APP-PSQL-META-COMMANDS-COPY)。稍微不同的命令可让您将 to/from 文件复制到您的服务器。
此处不同的原因是因为您正在连接到远程服务器(我假设),但导入的是本地文件。
另一种选择是传递您的文件并让 psql
从标准输入中读取
-c "copy externals (id,logo_path,favicon_path,cover_path,header,description,sign_enable,sign_text,footer_logo_enable,footer_logo_path,footer_text,created_at,updated_at) from STDIN with delimiter as ','" < /Applications/MAMP/htdocs/code/benu/ssc-portal/public/csv/externals.csv