Solve the problem that the postgresql service on the local computer stops after starting

  • I downloaded the 12 version of pgsql, but because the 11 version existed on the computer before, I didn’t uninstall it. After configuring the system variables and modifying some data files, I restarted the 12 version in the service and found an error:

 Previously set in postgresql.conf:

  • listen_addresses = '*' (can be accessed remotely),
  • file maximum connection limit,
  • log file:

In the pg_hba.conf file, allow all ip to connect remotely

solve

1. First open Task Manager->Services to check whether two versions of postgresql exist at the same time. It is found that pgsql versions 11 and 12 exist at the same time. After disabling version 11, it still cannot be started. Try to uninstall version 11;

2. Uninstall the pgsql version 11. Note that you can’t just delete the root directory when uninstalling: 

  • Shut down the PostgreSQL-11 service
  • Uninstall the PostGIS extension (double-click to run)
  • Uninstall PostgreSQL (double-click to run)
  • Delete residual files in the PostgreSQL installation directory.
  • Delete the pgAdmin folder, located under C:\Users"username"\AppData\Roaming\.

3. It is found that 12 cannot be run after uninstalling 11, to configure the Windows log, open the pgsql installation directory->data->postgresql.conf

log_destination = 'csvlog'   // 将日志输出为csv文件;

log_min_messages = log

// 以下3个不再记录语句错误信息,更方便分析;

log_min_error_statement = log

client_min_messages = log

log_directory = 'log'   // 输出日志的目录;

4. After configuring and restarting the service, the startup is successful.

Guess you like

Origin blog.csdn.net/qq_51978639/article/details/128845452