When Psql is executed, no password is set.

Source: Internet
Author: User
Tags psql

When Psql is executed, no password is set.

The customer sent a lot of *. SQL files for creating database tables. If you run them one by one, it will be a waste of time. In this way, I implemented a batch processing file (BAT file) to operate multiple *. SQL statements at a time. However, this problem occurs because my batch processing is written like this:
@ Echo off
For % C in (*. SQL) Do Psql-D ucom-u ucom_user-F % C
Pause
In this way, Psql requires you to enter a password every time you run a *. SQL file. How can I cancel the password so that these files are processed at one time? I checked it online. There is a solution.
In the windwos environment, create a file such as % appdata % \ PostgreSQL \ pgpass. conf with the following content:
Hostname: Port: Database: Username: password where hostname is the host address, port is the database port, and the following three parameters are the database name, login user, and login password respectively. For example, my file is set as localhost: 5432: ucom: ucom_user. In this way, the above batch processing will be executed, and it will be OK once, and no password needs to be entered repeatedly. The variable % appdata % is a brief description of the application data path, which may be: C: \ Documents ents and Settings \ [user name] \ Application Data Directory.

 

This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/v_fei/archive/2007/11/19/1893562.aspx

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.