phpMyAdmin Probleme

f0x

Punk
Hi,
Folgendes Problem tat sich mir bei der Konfiguration von phpMyAdmin (installiert aus den packages 4.3 OpenBSD) auf:

Ich bekomme beim Einlog-Versuch von phpMyAdmin die Meldung
Code:
#2002 - Der Server antwortet nicht. (evtl. ist auch der Socket des lokalen MySQL-Servers socket nicht korrekt konfiguriert)
Ich habe bereits mehrere Stunden damit verbracht, nach Lösungen zu Suchen oder Fehler zu finden, jedoch erfolglos.

Und so siehts aus:
phpMyAdmin liegt in dem Verzeichniss /var/www/inthtdocs (virtueller server nur für internen Zugriff)

die phpMyAdmin config.ini.php sieht so aus:
Code:
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '123';
$cfg['Servers'][$i]['socket'] = '/mysql/mysql.sock';
/* Select mysqli if your server has it */
$cfg['Servers'][$i]['extension'] = 'mysql';

MySQL hat via mysql -u root -p 123 sein passwort zugewiesen bekommen und startet über
Code:
/usr/local/bin/mysqld_safe --user=_mysql &

Nun hab ich mir von anfang an gedacht, dass phpMyAdmin ja im chroot von Apache läuft und deshalb via ln -s mysql.sock in das Verzeichniss /var/www/mysql/ verlinkt.

tmp Verzeichniss hab ich ebenfalls erstellt!

my.cnf sieht so aus:
Code:
# The following options will be passed to all MySQL clients
[client]
#password	= your_password
port		= 3306
socket		= /var/run/mysql/mysql.sock

[mysqld]
port		= 3306
socket		= /var/run/mysql/mysql.sock
skip-locking
key_buffer = 16M
max_allowed_packet = 1M
table_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
bind_address = 127.0.0.1

Die php.ini so:
Code:
[MySQL]
; Allow or prevent persistent links.
mysql.allow_persistent = On

; Maximum number of persistent links.  -1 means no limit.
mysql.max_persistent = -1

; Maximum number of links (persistent + non-persistent).  -1 means no limit.
mysql.max_links = -1

; Default port number for mysql_connect().  If unset, mysql_connect() will use
; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the
; compile-time value defined MYSQL_PORT (in that order).  Win32 will only look
; at MYSQL_PORT.
mysql.default_port = 3306

; Default socket name for local MySQL connects.  If empty, uses the built-in
; MySQL defaults.
mysql.default_socket = /mysql/mysql.sock

; Default host for mysql_connect() (doesn't apply in safe mode).
mysql.default_host =

; Default user for mysql_connect() (doesn't apply in safe mode).
mysql.default_user =

; Default password for mysql_connect() (doesn't apply in safe mode).
; Note that this is generally a *bad* idea to store passwords in this file.
; *Any* user with PHP access can run 'echo get_cfg_var("mysql.default_password")
; and reveal this password!  And of course, any users with read access to this
; file will be able to reveal the password as well.
mysql.default_password =

; Maximum time (in seconds) for connect timeout. -1 means no limit
mysql.connect_timeout = 60

; Trace mode. When trace_mode is active (=On), warnings for table/index scans and
; SQL-Errors will be displayed.
mysql.trace_mode = Off

[MySQLi]

; Maximum number of links.  -1 means no limit.
mysqli.max_links = -1

; Default port number for mysqli_connect().  If unset, mysqli_connect() will use
; the $MYSQL_TCP_PORT or the mysql-tcp entry in /etc/services or the
; compile-time value defined MYSQL_PORT (in that order).  Win32 will only look
; at MYSQL_PORT.
mysqli.default_port = 3306

; Default socket name for local MySQL connects.  If empty, uses the built-in
; MySQL defaults.
mysqli.default_socket = /mysql/mysql.sock

; Default host for mysql_connect() (doesn't apply in safe mode).
mysqli.default_host =

; Default user for mysql_connect() (doesn't apply in safe mode).
mysqli.default_user =

; Default password for mysqli_connect() (doesn't apply in safe mode).
; Note that this is generally a *bad* idea to store passwords in this file.
; *Any* user with PHP access can run 'echo get_cfg_var("mysqli.default_pw")
; and reveal this password!  And of course, any users with read access to this
; file will be able to reveal the password as well.
mysqli.default_pw =

; Allow or prevent reconnect
mysqli.reconnect = Off

Achja, in der php.ini ist am ende auch noch extension=mysql.so vermerkt!

Trotz alledem bekomme ich beim Versuch eines Logins via phpMyAdmin mit root, 123 den Error #2002.

Via mysqsl console kann ich auf den Server Zugreifen, jedoch kann ich auch mit tools von extern wie z.B. MySQL Administrator nicht auf den Server zugreifen (server 123.23.23.123 (ich) is not allowed to connect to server).

Nmap findet den MySQL Server als offen (für meinen Rechner habe ich eh im mom alle regeln deaktiviert!)

Kann mir jemand helfen?

Grüße
f0x
 
Moin f0x,

soweit ich das erkennen kann, gibt es bei Deiner Konfiguration folgendes Problem:
Die Angaben zu den Sockets stimmen nicht überein:
Code:
[phpMyAdmin config.ini.php]
$cfg['Servers'][$i]['socket'] = '/mysql/mysql.sock';

[php.ini]
mysqli.default_socket = /mysql/mysql.sock
versus
Code:
[client]
socket		= /var/run/mysql/mysql.sock

[mysqld]
socket		= /var/run/mysql/mysql.sock
Das paßt nicht zusammen!

Mit Links darf man hier nicht arbeiten, da der Socket bei jedem Neustart des Daemons neu angelegt wird. Es hat auch nix mit Apache-Chroot zu tun, da sich das nur auf den PHP/HTML-Code bezieht. Der PHP-Interpreter läuft nämlich nicht in dieser Umgebung, weshalb man bei der Konfiguration auch sehr sorgfältig sein muß.

JueDan
 
my.cnf läuft ja außerhalb des chroots, und die cinfig.ini + php.ini zielen jau auf den link innerhalb des chroots, von daher sollte my.cnf doch eigentlich keine probleme machen oder? Die mysql.sock in /mysql ist ja eh nur n link zu /var/run/mysql/mysql.sock ...
 
Hallo f0x,

my.cnf läuft ja außerhalb des chroots, und die cinfig.ini + php.ini zielen jau auf den link innerhalb des chroots, von daher sollte my.cnf doch eigentlich keine probleme machen oder? Die mysql.sock in /mysql ist ja eh nur n link zu /var/run/mysql/mysql.sock ...

juedan said:
Mit Links darf man hier nicht arbeiten, da der Socket bei jedem Neustart des Daemons neu angelegt wird.

JueDan
 
Da steht

Code:
$cfg['Servers'][$i]['connect_type'] = 'tcp';

D.h. der unix-domain Socket wird nicht benutzt. Ich tippe mal darauf, dass das Teil `localhost' nicht resolven kann. Entweder mal `127.0.0.1' stattdessen nehmen, oder dem Apachen noch ein passendes etc/hsts und etc/resolv.conf unter /var/www spendieren.
 
Sorry juedan... irgendwie überlesen :ugly: - mein Fehler.

Wie kann ich denn den socket ins chroot bekommen?
 
Juhuuuuuuu!!!!!! Es funktioniert!!!!!!!
:) :) :) :) :) :) :) :) :) :) :) :) :) :)
Danke für eure Hilfe!

Es lag an der pma config.ini.php!

Habe localhost in 127.0.0.1 geändert! Jetzt gehts! Danke an euch alle!

HAPPY!!!!

Achja, nur mal so, wie kann ich denn allgemein einen socket ins chroot bekommen?
In diesem thread hier schreibt Sir_Blizzardz was von via my.cnf ins chroot! meint der damit das in der my.cnf als socket das chroot eingetragen wird um dort den socket statt in /var/run/mysql zu erstellen?
Bei mir hat das näämlich nicht funktioniert! stattdessen startete mysqld nicht mehr!

MfG
f0x
 
Back
Top