Keine Verbindung zur Datenbank

MySQL, PostgreSQL, SQLite
stefan_w
Posts: 48
Joined: 2002-11-09 09:32

Keine Verbindung zur Datenbank

Post by stefan_w » 2003-05-25 00:00

Hi

Ich kriege meine PHP-Anwendungen einfach nicht zum Laufen. MYSQL läuft und die Datenbanken sind eingespielt. Auch die User sind soweit mit den richtigen Rechten eingesetzt. Aber trotzdem krieg ich keine Verbindung zur Datenbank.
Ich habe das System frisch aufgesetzt, fehlt mir eventuell noch ein Paket?
Ich habe Debian mit PHP4 drauf. Die Errorlogs sagen leider nichts aus.

Meine my.cnf:
# You can copy this to one of:
# /etc/mysql/my.cnf to set global options,
# mysql-data-dir/my.cnf to set server-specific options (in this
# installation this directory is /var/lib/mysql) or
# ~/.my.cnf to set user-specific options.
#
# One can use all long options that the program supports.
# Run the program with --help to get a list of available options

# This will be passed to all mysql clients
[client]
#password = my_password
port = 3306
socket = /var/run/mysqld/mysqld.sock

# Here is entries for some specific programs
# The following values assume you have at least 32M ram

[safe_mysqld]
err-log = /var/log/mysql/mysql.err

[mysqld]
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
#
# You can also put it into /var/log/mysql/mysql.log but I leave it in /var/log
# for backward compatibility. Both location gets rotated by the cronjob.
#log = /var/log/mysql/mysql.log
log = /var/log/mysql.log
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
language = /usr/share/mysql/english
skip-locking
#
# The skip-networkin option will no longer be set via debconf menu.
# You have to manually change it if you want networking i.e. the server
# listening on port 3306. The default is "disable" - for security reasons.
#skip-networking
set-variable = key_buffer=16M
set-variable = max_allowed_packet=1M
set-variable = thread_stack=128K
#
# Here you can see queries with especially long duration
#log-slow-queries = /var/log/mysql/mysql-slow.log
#
# The following can be used as easy to replay backup logs or for replication
#server-id = 1
#log-bin = /var/log/mysql/mysql-bin.log
#binlog-do-db = include_database_name
#binlog-ignore-db = include_database_name
#
# Read the manual if you want to enable InnoDB!
skip-innodb

[mysqldump]
quick
set-variable = max_allowed_packet=3M

[mysql]
no-auto-rehash # faster start of mysql but no tab completition

[isamchk]
set-variable = key_buffer=16M
mfg, Stefan

oxygen
Posts: 2138
Joined: 2002-12-15 00:10
Location: Bergheim

Re: Keine Verbindung zur Datenbank

Post by oxygen » 2003-05-25 00:40

Ã?hm. Also du solltest lieber mal die Fehlermeldung als die mysql.cnf posten. Ein paar typische Fehlerquellen sind: Falscher socket-Pfad, fehlende/falsche Rechte, falscher Host angegeben.

stefan_w
Posts: 48
Joined: 2002-11-09 09:32

Re: Keine Verbindung zur Datenbank

Post by stefan_w » 2003-05-25 09:42

Klar, kann ich machen.
/usr/sbin/mysqld, Version: 3.23.49-log, started with:
Tcp port: 0 Unix socket: /var/run/mysqld/mysqld.sock
Time Id Command Argument
030524 22:54:03 1 Connect debian-sys-maint@localhost on
1 Quit
2 Connect debian-sys-maint@localhost on
2 Quit
030524 22:54:06 3 Connect K678V613@localhost on
3 Statistics
3 Quit
4 Connect K678V613@localhost on
4 Query show databases
4 Quit
030524 22:54:15 5 Connect K678V613@localhost on
5 Query SELECT VERSION() AS version
5 Query SHOW VARIABLES LIKE 'safe_show_database'
5 Query SELECT User, Select_priv FROM mysql.user WHERE User = 'K678V613'
5 Query SELECT VERSION() as version, USER() as user
5 Query SELECT COUNT(*) FROM mysql.user
5 Query SELECT Create_priv, Process_priv, Reload_priv FROM mysql.user WHERE User = 'K678V613'
5 Quit
030524 22:54:16 6 Connect K678V613@localhost on
6 Query SELECT VERSION() AS version
6 Query SHOW VARIABLES LIKE 'safe_show_database'
6 Query SELECT User, Select_priv FROM mysql.user WHERE User = 'K678V613'
6 Query SELECT VERSION() as version, USER() as user
6 Query FLUSH PRIVILEGES
6 Query SELECT COUNT(*) FROM mysql.user
6 Query SELECT Create_priv, Process_priv, Reload_priv FROM mysql.user WHERE User = 'K678V613'
6 Quit
030524 22:54:18 7 Connect K678V613@localhost on
7 Query SELECT VERSION() AS version
7 Query SHOW VARIABLES LIKE 'safe_show_database'
7 Query SELECT User, Select_priv FROM mysql.user WHERE User = 'K678V613'
7 Query SELECT COUNT(*) FROM mysql.user
7 Query USE mysql
7 Query SELECT `User`, `Host`, IF(`Password` = "", "N", "Y") AS "Password", `Select_priv`, `Insert_priv`, `Update_priv`, `Delete_priv`, `Index_priv`, `Alter_priv`, `Create_priv`, `Drop_priv`, `Grant_priv`, `References_priv`, `Reload_priv`, `Shutdown_priv`, `Process_priv`, `File_priv` FROM `user` ORDER BY `User` ASC, `Host` ASC
7 Quit
030524 22:54:34 8 Connect K678V613@localhost on
8 Query SELECT VERSION() AS version
8 Query SHOW VARIABLES LIKE 'safe_show_database'
8 Query SELECT User, Select_priv FROM mysql.user WHERE User = 'K678V613'
8 Query SELECT COUNT(*) FROM mysql.user
8 Query USE mysql
8 Query SELECT "foo" FROM `user` WHERE `User` = "homeworld" AND `Host` = "%"
8 Query SELECT * FROM `user` WHERE `User` = "homeworld" AND `Host` = "%"
8 Query SELECT * FROM `db` WHERE `Host` = "%" AND `User` = "homeworld" ORDER BY `Db` ASC
8 Query SELECT `Db` FROM `tables_priv` WHERE `Host` = "%" AND `User` = "homeworld" GROUP BY `Db` ORDER BY `Db` ASC
8 Query SHOW DATABASES
8 Query SELECT USER()
8 Quit
030524 22:54:40 9 Connect K678V613@localhost on
9 Query SELECT VERSION() AS version
9 Query SHOW VARIABLES LIKE 'safe_show_database'
9 Query SELECT User, Select_priv FROM mysql.user WHERE User = 'K678V613'
9 Query SELECT VERSION() as version, USER() as user
9 Query SELECT COUNT(*) FROM mysql.user
9 Query SELECT Create_priv, Process_priv, Reload_priv FROM mysql.user WHERE User = 'K678V613'
9 Quit
030524 22:54:43 10 Connect K678V613@localhost on
10 Query SELECT VERSION() AS version
10 Query SHOW VARIABLES LIKE 'safe_show_database'
10 Query SELECT User, Select_priv FROM mysql.user WHERE User = 'K678V613'
10 Query SELECT COUNT(*) FROM mysql.user
10 Query USE mysql
10 Query SELECT `User`, `Host`, IF(`Password` = "", "N", "Y") AS "Password", `Select_priv`, `Insert_priv`, `Update_priv`, `Delete_priv`, `Index_priv`, `Alter_priv`, `Create_priv`, `Drop_priv`, `Grant_priv`, `References_priv`, `Reload_priv`, `Shutdown_priv`, `Process_priv`, `File_priv` FROM `user` ORDER BY `User` ASC, `Host` ASC
10 Quit
030524 22:54:53 11 Connect K678V613@localhost on
11 Query SELECT VERSION() AS version
11 Query SHOW VARIABLES LIKE 'safe_show_database'
11 Query SELECT User, Select_priv FROM mysql.user WHERE User = 'K678V613'
11 Query SELECT COUNT(*) FROM mysql.user
11 Query USE mysql
11 Query SELECT "foo" FROM `user` WHERE `User` = "homeworld" AND `Host` = "%"
11 Query SELECT * FROM `user` WHERE `User` = "homeworld" AND `Host` = "%"
11 Query SELECT * FROM `db` WHERE `Host` = "%" AND `User` = "homeworld" ORDER BY `Db` ASC
11 Query SELECT `Db` FROM `tables_priv` WHERE `Host` = "%" AND `User` = "homeworld" GROUP BY `Db` ORDER BY `Db` ASC
11 Query SHOW DATABASES
11 Query SELECT USER()
11 Quit
030524 22:55:06 12 Connect K678V613@localhost on
12 Query SELECT VERSION() AS version
12 Query SHOW VARIABLES LIKE 'safe_show_database'
12 Query SELECT User, Select_priv FROM mysql.user WHERE User = 'K678V613'
12 Query SELECT COUNT(*) FROM mysql.user
12 Query USE mysql
12 Query REVOKE ALL PRIVILEGES ON *.* FROM "homeworld"@"%"
12 Query REVOKE GRANT OPTION ON *.* FROM "homeworld"@"%"
12 Query GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, INDEX, ALTER ON *.* TO "homeworld"@"%"
12 Query SELECT "foo" FROM `user` WHERE `User` = "homeworld" AND `Host` = "%"
12 Query SELECT * FROM `user` WHERE `User` = "homeworld" AND `Host` = "%"
12 Query SELECT * FROM `db` WHERE `Host` = "%" AND `User` = "homeworld" ORDER BY `Db` ASC
12 Query SELECT `Db` FROM `tables_priv` WHERE `Host` = "%" AND `User` = "homeworld" GROUP BY `Db` ORDER BY `Db` ASC
12 Query SHOW DATABASES
12 Query SELECT USER()
12 Quit
030524 22:55:09 13 Connect K678V613@localhost on
13 Query SELECT VERSION() AS version
13 Query SHOW VARIABLES LIKE 'safe_show_database'
13 Query SELECT User, Select_priv FROM mysql.user WHERE User = 'K678V613'
13 Query SELECT VERSION() as version, USER() as user
13 Query SELECT COUNT(*) FROM mysql.user
13 Query SELECT Create_priv, Process_priv, Reload_priv FROM mysql.user WHERE User = 'K678V613'
13 Quit
030524 22:55:11 14 Connect K678V613@localhost on
14 Query SELECT VERSION() AS version
14 Query SHOW VARIABLES LIKE 'safe_show_database'
14 Query SELECT User, Select_priv FROM mysql.user WHERE User = 'K678V613'
14 Query SELECT VERSION() as version, USER() as user
14 Query FLUSH PRIVILEGES
14 Query SELECT COUNT(*) FROM mysql.user
14 Query SELECT Create_priv, Process_priv, Reload_priv FROM mysql.user WHERE User = 'K678V613'
14 Quit
030524 23:17:07 15 Connect K678V613@localhost on
15 Statistics
15 Quit
16 Connect K678V613@localhost on
16 Query show databases
16 Quit
/usr/sbin/mysqld, Version: 3.23.49-log, started with:
Tcp port: 0 Unix socket: /var/run/mysqld/mysqld.sock
Time Id Command Argument
030524 23:29:18 1 Connect debian-sys-maint@localhost on
1 Quit
2 Connect debian-sys-maint@localhost on
2 Quit
030524 23:54:49 3 Connect K678V613@localhost on
3 Statistics
3 Quit
4 Connect K678V613@localhost on
4 Query show databases
4 Quit
030524 23:54:50 5 Connect debian-sys-maint@localhost on
5 Quit
6 Connect debian-sys-maint@localhost on
6 Query SHOW VARIABLES LIKE 'pid_file'
6 Shutdown
/usr/sbin/mysqld, Version: 3.23.49-log, started with:
Tcp port: 3306 Unix socket: /var/run/mysqld/mysqld.sock
Time Id Command Argument
030524 23:54:55 1 Connect debian-sys-maint@localhost on
1 Quit
2 Connect debian-sys-maint@localhost on
2 Quit
030524 23:54:57 3 Connect K678V613@localhost on
3 Statistics
3 Quit
4 Connect K678V613@localhost on
4 Query show databases
4 Quit
030525 6:25:32 5 Connect debian-sys-maint@localhost on
5 Quit
6 Connect debian-sys-maint@localhost on
6 Refresh
/usr/sbin/mysqld, Version: 3.23.49-log, started with:
Tcp port: 3306 Unix socket: /var/run/mysqld/mysqld.sock
Time Id Command Argument
030525 6:25:32 6 Quit

oxygen
Posts: 2138
Joined: 2002-12-15 00:10
Location: Bergheim

Re: Keine Verbindung zur Datenbank

Post by oxygen » 2003-05-25 13:41

Ich meinte eigentlich die Fehlermeldung die PHP auspuckt. Laut deinem mysql-log funktioniert das ganze einwandfrei, verscheidene User connecten und setzten Querys ab.

stefan_w
Posts: 48
Joined: 2002-11-09 09:32

Re: Keine Verbindung zur Datenbank

Post by stefan_w » 2003-05-25 16:11

Ja, das ist richtig. Die Datenbank läuft wunderbar.

Aber zum Beispiel das VBulletin meldet:
Fatal error: Call to undefined function: mysql_connect() in /var/www/user1/user1-2.tld/html/v2/forum/admin/db_mysql.php on line 40
Die betreffende Zeile 40:
$this->link_id=mysql_connect($this->server,$this->user,$this->password);
Es bekommt also keine Verbindung zur Datenbank. Ich habe PHP4 drauf, kann es vielleicht sein, das mir ein Modul fehlt?
Komischerweise läuft PHPMyAdmin ohne Probleme...

stefan_w
Posts: 48
Joined: 2002-11-09 09:32

Re: Keine Verbindung zur Datenbank

Post by stefan_w » 2003-05-25 18:25

Wie ich gesagt habe fehlte mir ein Modul. Ich Dödel habe php4-mysql vergessen. :roll:

Ich könnte spucken...