[postgresql] phppgadmin

phppgadmin [postgresql] - réseaux et sécurité - Linux et OS Alternatifs

Marsh Posté le 28-05-2003 à 15:18:00    

Bonjour
pourriez vous me dire pourquoi je n'arrive pas à me connecter à postgresql avec phppgadmin (j'ai installé postgresql avec apt - debian)
J'arrive bien à aller sur la page d'identification mais j'ai toujours un access denied !
 
Par contre en ligne de commande ca marche tres bien:  
su postgre
psql -d template1
 
Merci pour votre aide
 
Ohan
 
 

Reply

Marsh Posté le 28-05-2003 à 15:18:00   

Reply

Marsh Posté le 29-05-2003 à 20:00:57    

salut,
 
J'ai eu le même problème, mais ce n'était pas sur une Debian...
 
La solution que j'ai trouvé c'est de modifier le fichier de conf. de postgresql ( /var/lib/pgsql/data/postgresql.conf ) et de mettre  tcpip_socket sur "true". ( tcpip_socket = true )  
 
J'ai également rajouté cette ligne dans pg_hba.conf:
 
host       all         127.0.0.1     255.255.255.255    trust
 
Voilà, si ça peu aider...


Message édité par JYS le 29-05-2003 à 20:02:02
Reply

Marsh Posté le 04-06-2003 à 10:40:51    

merci pour ta réponse mais ca ne marche toujours pas !
Si qq'un avait une autre solution, ca serait vraiment sympas.
++
Ohan


Message édité par ohan le 04-06-2003 à 11:05:07
Reply

Marsh Posté le 04-06-2003 à 10:54:17    

d'abord, on dit "si quelqu'un avait" et pas aurait!
 
par quelle ligne de commande est démarré ton postgres? il accepte les connections tcpip? (option -i)

Reply

Marsh Posté le 04-06-2003 à 11:07:56    

merci c'était le -i !!!
Par contre,comme il se lance au demarrage dans le init.d, comment lui dire de lancer postgre avec -i ?
 
Merci pour votre aide (avec postgres et en grammaire !)
 
Ohan

Reply

Marsh Posté le 04-06-2003 à 11:11:18    

bon alors petit cours rapide sur ton init.d :
dedans, tu as des scripts. dans ces scripts tu as des "commandes", qui arrêtent, démarrent ou redémarrent tes services. pour postgresql, tu dois avoir un script appelé postgres dans /etc/init.d
 
dans ce script, tu as un bloc dédié au démarrage du serveur postgresql. tu trouves la commandes et y ajoute le -i
 

Reply

Marsh Posté le 04-06-2003 à 11:16:59    

j'ai fais vi postgresql mais je ne trouve pas la comande qui lance postgres pour y ajouter le -i a la fin !
tu pourrais m'en dire plus ?
 
merci
Ohan

Reply

Marsh Posté le 04-06-2003 à 11:20:49    

voilà mon mien (redhat 8, postgres 7.3), il marche très bien :

Code :
  1. #! /bin/sh
  2. # postgresql This is the init script for starting up the PostgreSQL
  3. #  server
  4. #
  5. # chkconfig: - 85 15
  6. # description: Starts and stops the PostgreSQL backend daemon that handles \
  7. #        all database requests.
  8. # processname: postmaster
  9. # pidfile: /var/run/postmaster.pid
  10. # Version 6.5.3-2 Lamar Owen
  11. # Added code to determine if PGDATA exists, whether it is current version
  12. #     or not, and initdb if no PGDATA (initdb will not overwrite a database).
  13. # Version 7.0 Lamar Owen
  14. # Added logging code
  15. # Changed PGDATA.
  16. #
  17. # Version 7.0.2 Trond Eivind Glomsrød <teg@redhat.com>
  18. # use functions, add conditional restart
  19.          
  20. # Version 7.0.3 Lamar Owen <lamar@postgresql.org>
  21. # Check for the existence of functions before blindly using them
  22. # in particular -- check for success () and failure () before using.
  23. # More Cross-distribution support -- PGVERSION variable, and docdir checks.
  24. # Version 7.1 Release Candidate Lamar Owen <lamar@postgresql.org>
  25. # initdb parameters have changed.
  26. # Version 7.1.2 Trond Eivind Glomsrød <teg@redhat.com>
  27. # Specify shell for su
  28. # Handle stop better - kill unwanted output, make it wait until the database is ready
  29. # Handle locales slightly differently - always using "C" isn't a valid option
  30. # Kill output from database initialization
  31. # Mark messages for translation
  32. # Version 7.1.2-2.PGDG Lamar Owen <lamar.owen@wgcr.org>
  33. # sync up.
  34. # Karl's fixes for some quoting issues.
  35. # Version 7.2b2 Lamar Owen <lamar.owen@wgcr.org>
  36. # version change.
  37. # Version 7.2 final.  Lamar Owen <lamar.owen@wgcr.org>
  38. # reload from Peter E.
  39. # Eliminate the pidof postmaster test in stop -- we're using pg_ctl so we don't need pidof.
  40. # Tested the $? return for the stop script -- it does in fact propagate.
  41. # TODO: multiple postmasters.
  42. # PGVERSION is:  (note that PGVERSION is the major: 7.2.1 -> PGVERSION 7.2)
  43. PGVERSION=7.2
  44. # Source function library.
  45. INITD=/etc/rc.d/init.d
  46. . $INITD/functions
  47. # Get function listing for cross-distribution logic.
  48. TYPESET=`typeset -f|grep "declare"`
  49. # Get config.
  50. . /etc/sysconfig/network
  51. # Check that networking is up.
  52. # Pretty much need it for postmaster.
  53. [ "${NETWORKING}" = "no" ] && exit 0
  54. [ -f /usr/bin/postmaster ] || exit 0
  55. start(){
  56. PSQL_START=$"Starting postgresql service: "
  57. # Check for older PGDATA location.
  58. if [ -f /var/lib/pgsql/PG_VERSION ] && [ -d /var/lib/pgsql/base/template1 ]
  59. then
  60.  export PGDATA=/var/lib/pgsql
  61. else
  62.  export PGDATA=/var/lib/pgsql/data
  63. fi
  64. # Check for the PGDATA structure
  65. if [ -f $PGDATA/PG_VERSION ] && [ -d $PGDATA/base ]
  66. then
  67. # Check version of existing PGDATA
  68.  if [ `cat $PGDATA/PG_VERSION` != '7.2' ]
  69.  then
  70.   SYSDOCDIR="(Your System's documentation directory)"
  71.   if [ -d /usr/doc/postgresql-$PGVERSION ]
  72.   then
  73.    SYSDOCDIR=/usr/doc
  74.   fi
  75.   if [ -d /usr/share/doc/postgresql-$PGVERSION ]
  76.   then
  77.    SYSDOCDIR=/usr/share/doc
  78.   fi
  79.   if [ -d /usr/doc/packages/postgresql-$PGVERSION ]
  80.   then
  81.    SYSDOCDIR=/usr/doc/packages
  82.   fi
  83.   if [ -d /usr/share/doc/packages/postgresql-$PGVERSION ]
  84.   then
  85.    SYSDOCDIR=/usr/share/doc/packages
  86.   fi
  87.   echo
  88.   echo $"An old version of the database format was found.\nYou need to upgrade the data format before using PostgreSQL.\nSee $SYSDOCDIR/postgresql-$PGVERSION/README.rpm-dist for more information."
  89.   exit 1
  90. #                       This doesn't seem to do anything useful...
  91. #  else
  92. #   if echo "$TYPESET"|grep "declare -f success ()" >/dev/null
  93. #   then
  94. #    success "$PSQL_CHECK"
  95. #   else
  96. #    echo "  [ OK ]"
  97. #   fi
  98. #   echo
  99.  fi
  100. # No existing PGDATA! Initdb it.
  101. else
  102.         echo -n $"Initializing database: "
  103.                 if [ ! -d $PGDATA ]
  104.  then
  105.   mkdir -p $PGDATA
  106.   chown postgres.postgres $PGDATA
  107.  fi
  108.  # Initialize the database
  109.  su -l postgres -s /bin/sh -c "/usr/bin/initdb --pgdata=/var/lib/pgsql/data > /dev/null 2>&1" < /dev/null
  110.  [ -f $PGDATA/PG_VERSION ] && echo_success
  111.  [ ! -f $PGDATA/PG_VERSION ] && echo_failure
  112.  echo
  113.  fi
  114. # Check for postmaster already running...
  115. pid=`pidof -s postmaster`
  116. if [ $pid ]
  117. then
  118.  echo $"Postmaster already running."
  119. else
  120.  #all systems go -- remove any stale lock files
  121.  rm -f /tmp/.s.PGSQL.* > /dev/null
  122.  echo -n "$PSQL_START"
  123. su -l postgres -s /bin/sh -c "postmaster -i -D $PGDATA -S  > /dev/null 2>&1" < /dev/null
  124.   sleep 1
  125.   pid=`pidof -s postmaster`
  126.   if [ $pid ]
  127.  then
  128.   success "$PSQL_START"
  129.   touch /var/lock/subsys/postgresql
  130.   echo $pid > /var/run/postmaster.pid
  131.   echo
  132.  else
  133.   failure "$PSQL_START"
  134.   echo
  135.  fi
  136. fi
  137. }
  138. stop(){
  139. echo -n $"Stopping postgresql service: "
  140. # Check for older PGDATA location.
  141. if [ -f /var/lib/pgsql/PG_VERSION ] && [ -d /var/lib/pgsql/base/template1 ]
  142. then
  143.  export PGDATA=/var/lib/pgsql
  144. else
  145.  export PGDATA=/var/lib/pgsql/data
  146. fi
  147. su -l postgres -s /bin/sh -c "/usr/bin/pg_ctl stop -D $PGDATA -s -m fast" > /dev/null 2>&1
  148.         ret=$?
  149.         if [ $ret -eq 0 ]; then
  150.     echo_success
  151.         else
  152.             echo_failure
  153.         fi
  154. echo
  155. rm -f /var/run/postmaster.pid
  156. rm -f /var/lock/subsys/postgresql
  157. }
  158. restart(){
  159.     stop
  160.     start
  161. }
  162. condrestart(){
  163.     [ -e /var/lock/subsys/postgresql ] && restart || :
  164. }
  165. reload(){
  166.     su -l postgres -s /bin/sh -c "/usr/bin/pg_ctl reload -D $PGDATA -s" > /dev/null 2>&1
  167. }
  168. # This script is slightly unusual in that the name of the daemon (postmaster)
  169. # is not the same as the name of the subsystem (postgresql)
  170. # See how we were called.
  171. case "$1" in
  172.   start)
  173. start
  174. ;;
  175.   stop)
  176. stop
  177. ;;
  178.   status)
  179. status postmaster
  180. ;;
  181.   restart)
  182. restart
  183. ;;
  184.   condrestart)
  185. condrestart
  186. ;;
  187.   reload|force-reload)
  188. reload
  189. ;;
  190.   *)
  191. echo $"Usage: $0 {start|stop|status|restart|condrestart|reload|force-reload}"
  192. exit 1
  193. esac
  194. exit 0


 
j'ai essayé de mettre en gras la ligne ad hoc ([b][/b]), mais ça moarche poas!
 
regardes dans le texte!


Message édité par arghbis le 04-06-2003 à 11:22:04
Reply

Marsh Posté le 04-06-2003 à 11:34:32    

voilà aussi le miens car j'ai trouvé aucun correspondance entre les 2  :fou:  
 

Code :
  1. #! /bin/bash
  2. #
  3. # NOTE TO SYSTEM ADMINISTRATORS #
  4. # To stop postgresql running, do
  5. #   ln -sf /bin/false /usr/lib/postgresql/bin/can_i_run
  6. # To re-enable it, do
  7. #   rm /usr/lib/postgresql/bin/can_i_run
  8. startup () {
  9.         touch ${POSTGRES_LOG:=/var/log/postgres.log}
  10.         chown postgres.postgres $POSTGRES_LOG
  11.         su - postgres -c /usr/lib/postgresql/bin/postgresql-startup
  12. # set file-max kernel parameter
  13. . /etc/postgresql/postmaster.conf
  14. fmaxfile=/proc/sys/kernel/file-max
  15. if [ ! -r $fmaxfile ]
  16. then
  17.  fmaxfile=/proc/sys/kernel/fs/file-max
  18.  if [ ! -r $fmaxfile ]
  19.  then
  20.   fmaxfile=/proc/sys/fs/file-max
  21.   if [ ! -r $fmaxfile ]
  22.   then
  23.    fmaxfile=
  24.   fi
  25.  fi
  26. fi
  27. if [ -n "$fmaxfile" ]
  28. then
  29.  fmax=`cat $fmaxfile`
  30.  if [ $fmax -lt ${KERNEL_FILE_MAX:=1032} ]
  31.  then
  32.   echo ${KERNEL_FILE_MAX} > $fmaxfile
  33.  fi
  34. fi
  35. }
  36. POSTMASTER=/usr/lib/postgresql/bin/postmaster
  37. . /etc/postgresql/postmaster.conf
  38. PGDATA=${POSTGRES_DATA:-/var/lib/postgres/data}
  39. export PGDATA
  40. case "$1" in
  41.     start)
  42.         startup
  43.         ;;
  44.     stop)
  45.         echo "Stopping PostgreSQL database: postmaster"
  46.         start-stop-daemon --stop --verbose --exec ${POSTMASTER} || exit 0
  47. echo "."
  48.         ;;
  49.     restart)
  50.         echo "Restarting PostgreSQL database: postmaster"
  51.         start-stop-daemon --stop --oknodo --verbose --exec ${POSTMASTER}
  52.         sleep 3
  53.         startup
  54. echo "."
  55.         ;;
  56.     force-reload | reload)
  57.         /usr/lib/postgresql/bin/pg_ctl reload -D ${PGDATA}
  58.         ;;
  59.     *)
  60.         echo "Usage: /etc/init.d/postgresql {start|stop|restart|reload|force-reload}"
  61.         exit 1
  62.         ;;
  63. esac
  64. exit 0


encore merci pour ton aide
 
Ohan

Reply

Marsh Posté le 04-06-2003 à 11:40:12    

tu as quelle distribution?? ce fichier à l'air vraiment merdique!

Reply

Marsh Posté le 04-06-2003 à 11:40:12   

Reply

Marsh Posté le 04-06-2003 à 11:44:03    

une debian, j'ai  installé postgresql via apt-get install postgresql  

Reply

Marsh Posté le 04-06-2003 à 12:49:57    

ah oui, pardon, j'avais pas vu dans ton premier post!  :jap:  
 
bon on peut essayer un truc : tu fais un backup de ton script postgresql et tu mets le mien à la place (en changeant éventuellement le chemin des exécutables. ça devrait marcher.

Reply

Marsh Posté le 04-06-2003 à 14:19:41    

en fait, ca m'embete un peu de reprendre ton fichier car normalement avec apt-get install postgresql, tout les fichiers sont configurés pour ma machine et je voudrais juste modifier le miens pour arriver à mes fins !
Y'a pas une autre solution ?
 
On ne peut pas faire un script qui se lance au demarrage et qui fait
 

Citation :


./postgresql stop
./postgresql start -i

 
 
car quand je fais ca , ca marche super bien  
 
Merci
Ohan

Reply

Marsh Posté le 04-06-2003 à 14:21:58    

ben si en faisant postgresql start -i ça marche, rajoute -i dans ton startup en bas de page
 
case  
 start)
  startup -i;
;;

Reply

Marsh Posté le 04-06-2003 à 14:25:26    

merci
ca marche bien
++
Ohan

Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed