Page 1 of 1

MYSQL Verbindung

Posted: 2005-06-03 14:30
by umbroboy
Hallo,

habe mal eine Frage:

Immer wenn ich ein PHP Script einrichten möchte was eine Datenbankverbindung benötigt bekomm ich eine Fehlermeldung weil das system auf den falschen pfad greift.

mysql_select_db(): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /home/www/web0/html/allmyguest/include/sql.inc.php on line 40

eigentlich ist die sock datei woanders unter /var und so...

kann man dass irgendwo änder?

Vielen Dank schonmal für die vorschläge

Re: MYSQL Verbindung

Posted: 2005-06-03 14:36
by porschinho
guck mal in der datei /etc/my.cnf

da ist der pfad zu deiner mysql.sock eingetragen.

ansonsten leg die doch einfach dahin, wo er sie haben will :)

Re: MYSQL Verbindung

Posted: 2005-06-04 13:35
by umbroboy
Hallo,

nun das stimmt aber alles:


[mysqld]
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306


das einzige was auf tmp zeigt ist dieser eintrag:


tmpdir = /tmp

Oder darf ich dann bei den scripten nie localhost angeben sondern dass:
/var/run/mysqld/mysqld.sock

oder muss ich irgendeinen dienst nochmal neustarten?

Re: MYSQL Verbindung

Posted: 2005-06-04 16:25
by timeless2
Schau mal nach, ob du in einer Konfigurationsdatei irgendwo den Pfad zu
'/tmp/mysql.sock' findest und pass' es entsprechend an /var/run/mysqld/mysqld.sock

Dein Fehler trat hier auf:
/home/www/web0/html/allmyguest/include/sql.inc.php on line 40
Wenn du das zurückverfolgst, müsstest du eigentlich darauf stoßen.

Re: MYSQL Verbindung

Posted: 2005-06-04 18:51
by umbroboy
Hallo,

also wenn du die my.cnf meinst, da ist nichts.

# 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/local/mysql
datadir = /var/lib/mysql
tmpdir = /tmp
language = /usr/local/mysql/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
#SKIP_NETWORKING
set-variable = key_buffer=16M
set-variable = max_allowed_packet=1M
set-variable = thread_stack=128K
set-variable = table_cache=64
set-variable = sort_buffer=512K
set-variable = net_buffer_length=8K
set-variable = myisam_sort_buffer_size=8M
set-variable = max_connections=10000
set-variable = wait_timeout=15
set-variable = interactive_timeout=10
#
# 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
#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=1M

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

[isamchk]
set-variable = key_buffer=20M
set-variable = sort_buffer=20M
set-variable = read_buffer=2M
set-variable = write_buffer=2M

[myisamchk]
set-variable = key_buffer=20M
set-variable = sort_buffer=20M
set-variable = read_buffer=2M
set-variable = write_buffer=2M

Hab mal was gehört mit nem symbolischen link oder so?

Re: MYSQL Verbindung

Posted: 2005-06-05 02:00
by blueroot
Hi,

ein

Code: Select all

ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock
sollte Wunder wirken :)

---
Achja, die my.cnf würde ich wegen Abhängigkeitsproblemen nicht ändern.
Deswegen sollte das Softlinken am Besten geeignet sein.
Ansonsten kannst du auch den Link zum mysql.sock in den php-Einstellungen ändern. Aber wie oben beschrieben sollte es auch gehen.

Re: MYSQL Verbindung

Posted: 2005-06-05 12:30
by umbroboy
Hallo,

ja danke, das mit dem code ging.

Vielen Dank

Re: MYSQL Verbindung

Posted: 2005-11-10 00:05
by umbroboy
Hallo,

habe mein System upgedatet allerdings findet er keine :

mysql.sock'

mehr.

;-(

Wie kann dass sein?

Bekomme immer diese meldung:

ERROR 2002: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

Re: MYSQL Verbindung

Posted: 2005-11-10 10:11
by Joe User
MySQL gestartet?

Re: MYSQL Verbindung

Posted: 2005-11-10 11:42
by umbroboy
beim Starten kommt diese meldung schon.

Eine sock datei hab ich noch nicht gefunden.

hab aber jetzt wo gelesen, dass es ein paar examples für diese my.cnf datei gibt.

nur hab ich mich schon gefragt bzw. dachte ich dass dies automatisch erstellt wird.

*grübel*

Re: MYSQL Verbindung

Posted: 2005-11-10 14:55
by Joe User

Code: Select all

/etc/init.d/mysql stop
sleep 10 && pkill -u mysql
/etc/init.d/mysql start

Re: MYSQL Verbindung

Posted: 2005-11-10 20:49
by umbroboy
ja geht Danke.

nur irgendwie ist jetzt ein passwort drin.

;-(

und ich weiss es nicht. :-(

muss mal schauen, wie ich das löse...