Problema MySql

Se avete problemi con l'installazione e la configurazione di Slackware64 postate qui. Non usate questo forum per argomenti che trattano la Slackware32 o generali... per quelli usate rispettivamente il forum Slackware e Gnu/Linux in genere.

Moderatore: Staff

Regole del forum
1) Citare sempre la versione di Slackware64 usata, la versione del Kernel e magari anche la versione della libreria coinvolta. Questi dati aiutano le persone che possono rispondere.
2) Per evitare confusione prego inserire in questo forum solo topic che riguardano appunto Slackware64, se l'argomento è Slackware32 o generale usate rispettivamente il forum Slackware o Gnu/Linux in genere.
3) Leggere attentamente le risposte ricevute
4) Scrivere i messaggi con il colore di default, evitare altri colori.
5) Scrivere in Italiano o in Inglese, se possibile grammaticalmente corretto, evitate stili di scrittura poco chiari, quindi nessuna abbreviazione tipo telegramma o scrittura stile SMS o CHAT.
6) Appena registrati è consigliato presentarsi nel forum dedicato.

La non osservanza delle regole porta a provvedimenti di vari tipo da parte dello staff, in particolare la non osservanza della regola 5 porta alla cancellazione del post e alla segnalazione dell'utente. In caso di recidività l'utente rischia il ban temporaneo.
Avatar utente
rfringuello89
Linux 2.x
Linux 2.x
Messaggi: 246
Iscritto il: sab 21 feb 2009, 18:47
Nome Cognome: Renato Fringuello
Slackware: 64 current
Kernel: 3.13.3
Desktop: kde 4.12.4 [Alien]

Problema MySql

Messaggio da rfringuello89 »

Salve a tutti, quando avvio mysql ottengo questo errore:

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

Non riesco a darmi pace in quanto qualche tempo fa ero riuscito a configurarlo e accedevo al prompt tranquillamente. Avevo trovato una guida in cui c'erano alcuni comandi e mi avevano permesso di farlo funzionare, ora dopo aver formattato non trovo più tale guida. Vi prego di aiutarmi! Grazie

PS se avvio il demone da /etc/rc.d in questo modo: sh /etc/rc.d/rc.mysqld ottengo:

101113 14:42:44 mysqld_safe Logging to '/var/lib/mysql/darkstar.err'.
chown: invalid user: `mysql'
101113 14:42:44 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
101113 14:42:44 mysqld_safe mysqld from pid file /var/run/mysql/mysql.pid ended
"When you know Slackware, you know Linux… when you know Red Hat, all you know is Red Hat."

Avatar utente
414N
Iper Master
Iper Master
Messaggi: 2922
Iscritto il: mer 13 feb 2008, 16:19
Slackware: 15.0
Kernel: 5.15.19
Desktop: KDE5
Località: Bulagna
Contatta:

Re: Problema MySql

Messaggio da 414N »

Ma hai letto cosa c'è scritto all'inizio del file rc.mysqld?
rc.mysqld ha scritto: # To start MySQL automatically at boot, be sure this script is executable:
# chmod 755 /etc/rc.d/rc.mysqld

# Before you can run MySQL, you must have a database. To install an initial
# database, do this as root:
#
# mysql_install_db --user=mysql
#
# Note that the mysql user must exist in /etc/passwd, and the created files
# will be owned by this dedicated user. This is important, or else mysql
# (which runs as user "mysql") will not be able to write to the database
# later (this can be fixed with 'chown -R mysql.mysql /var/lib/mysql').
#
# To increase system security, consider using "mysql_secure_installation"
# as well. For more information on this tool, please read:
# man mysql_secure_installation
Tra l'altro, dovresti farlo partire così

Codice: Seleziona tutto

sh /etc/rc.d/rc.mysqld start

Avatar utente
rfringuello89
Linux 2.x
Linux 2.x
Messaggi: 246
Iscritto il: sab 21 feb 2009, 18:47
Nome Cognome: Renato Fringuello
Slackware: 64 current
Kernel: 3.13.3
Desktop: kde 4.12.4 [Alien]

Re: Problema MySql

Messaggio da rfringuello89 »

Si ovviamente lo avvio come mi hai postato. E eseguendo i comandi per settare la password utente ottengo sempre l'errore che ho postato nel primo messaggio.
Per esempio anche se avvio: mysql_secure_installation inserisco la password e ottengo:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2)

subito dopo mi viene riproposto di inserire la password:
Enter current password for root (enter for none):

Se qualcuno mi potesse aiutare dicendo l'esatta procedura di configurazione diciamo da dopo l'installazione del pacchetto sarei davvero molto grato
"When you know Slackware, you know Linux… when you know Red Hat, all you know is Red Hat."

Avatar utente
414N
Iper Master
Iper Master
Messaggi: 2922
Iscritto il: mer 13 feb 2008, 16:19
Slackware: 15.0
Kernel: 5.15.19
Desktop: KDE5
Località: Bulagna
Contatta:

Re: Problema MySql

Messaggio da 414N »

rfringuello89 ha scritto:E eseguendo i comandi per settare la password utente ottengo sempre l'errore che ho postato nel primo messaggio.
Quale password utente?
Nello script è scritto che per far funzionare correttamente il demone mysqld lanciato da rc.mysqld deve essere presente nel sistema (quindi in /etc/passwd) l'utente mysql. Può anche non avere nessuna password.
Te la cavi con un

Codice: Seleziona tutto

useradd mysql

Avatar utente
targzeta
Iper Master
Iper Master
Messaggi: 6629
Iscritto il: gio 3 nov 2005, 14:05
Nome Cognome: Emanuele Tomasi
Slackware: 64-current
Kernel: latest stable
Desktop: IceWM
Località: Carpignano Sal. (LE) <-> Pisa

Re: Problema MySql

Messaggio da targzeta »

Hai seguito le indicazioni dello script? Qui neongen ha postato una parte rilevante:
viewtopic.php?f=1&t=32632&p=285908l#p285769

Emanuele
Se pensi di essere troppo piccolo per fare la differenza, prova a dormire con una zanzara -- Dalai Lama

Avatar utente
rfringuello89
Linux 2.x
Linux 2.x
Messaggi: 246
Iscritto il: sab 21 feb 2009, 18:47
Nome Cognome: Renato Fringuello
Slackware: 64 current
Kernel: 3.13.3
Desktop: kde 4.12.4 [Alien]

Re: Problema MySql

Messaggio da rfringuello89 »

Allora, l'utente mysql è presente nel mio sistema. Per accedere a mysql prima usavo la sintassi mysql -u root -p e inserivo poi la password. Se lancio
sh /etc/rc.d/rc.mysqld start
ottengo comunque questo:

101113 18:55:54 mysqld_safe Logging to '/var/lib/mysql/darkstar.err'.
101113 18:55:54 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
101113 18:56:02 mysqld_safe mysqld from pid file /var/run/mysql/mysql.pid ended

e se provo a avviare mysql -u root ottengo:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2)
"When you know Slackware, you know Linux… when you know Red Hat, all you know is Red Hat."

Avatar utente
targzeta
Iper Master
Iper Master
Messaggi: 6629
Iscritto il: gio 3 nov 2005, 14:05
Nome Cognome: Emanuele Tomasi
Slackware: 64-current
Kernel: latest stable
Desktop: IceWM
Località: Carpignano Sal. (LE) <-> Pisa

Re: Problema MySql

Messaggio da targzeta »

Scusa se mi ripeto, ma l'hai letto il post che ti ho linkato prima?

Emanuele
Se pensi di essere troppo piccolo per fare la differenza, prova a dormire con una zanzara -- Dalai Lama

Avatar utente
rfringuello89
Linux 2.x
Linux 2.x
Messaggi: 246
Iscritto il: sab 21 feb 2009, 18:47
Nome Cognome: Renato Fringuello
Slackware: 64 current
Kernel: 3.13.3
Desktop: kde 4.12.4 [Alien]

Re: Problema MySql

Messaggio da rfringuello89 »

si che l'ho visto ma alla fine il problema dell'utente era che mancava il pacchetto! io il pacchetto ce l'ho! Vorrei solo ritrovare quella guida che avevo trovato in rete
"When you know Slackware, you know Linux… when you know Red Hat, all you know is Red Hat."

Avatar utente
targzeta
Iper Master
Iper Master
Messaggi: 6629
Iscritto il: gio 3 nov 2005, 14:05
Nome Cognome: Emanuele Tomasi
Slackware: 64-current
Kernel: latest stable
Desktop: IceWM
Località: Carpignano Sal. (LE) <-> Pisa

Re: Problema MySql

Messaggio da targzeta »

Io ti avevo detto di vedere la risposta di neongen, lì viene postato parte dello script per fa partire il server MySQL. In pratica una volta che hai installato il pacchetto devi anche configurare un minimo il server, come prima cosa devi creare l'utente proprietario del server e poi dargli una password, tutte cose scritte nel post di neongen che ti ho linkato. Se poi guardi l'output del comando che hai dato e leggi il file '.err' vedrai che ti spiega perchè il server si ferma.

Codice: Seleziona tutto

101113 18:56:02 mysqld_safe mysqld from pid file /var/run/mysql/mysql.pid ended
Emanuele
Se pensi di essere troppo piccolo per fare la differenza, prova a dormire con una zanzara -- Dalai Lama

Avatar utente
rfringuello89
Linux 2.x
Linux 2.x
Messaggi: 246
Iscritto il: sab 21 feb 2009, 18:47
Nome Cognome: Renato Fringuello
Slackware: 64 current
Kernel: 3.13.3
Desktop: kde 4.12.4 [Alien]

Re: Problema MySql RISOLTO

Messaggio da rfringuello89 »

Salve ragazzi ho ritrovato quella famosa guida:
http://php.html.it/guide/lezione/2508/c ... slackware/

dopo aver dato quei banali comandini funziona perfettamente.. Il problema era sicuramente dovuto a una questione di permessi. Grazie ancora a tutti voi
"When you know Slackware, you know Linux… when you know Red Hat, all you know is Red Hat."

Avatar utente
darkstaring
Linux 3.x
Linux 3.x
Messaggi: 657
Iscritto il: mer 13 ott 2010, 13:55
Nome Cognome: Francesco Achenza
Desktop: KDE
Distribuzione: Arch Linux
Contatta:

Re: Problema MySql

Messaggio da darkstaring »

Seraaaa...
Anche io avrei lo stesso problema...

Codice: Seleziona tutto

root@:francesco$ sh /etc/rc.d/rc.mysqld restart

root@:francesco$ 120703 19:22:53 mysqld_safe Logging to '/var/lib/mysql/darkstar.err'.
120703 19:22:53 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
120703 19:22:54 mysqld_safe mysqld from pid file /var/run/mysql/mysql.pid ended


root@:francesco$ mysql -u root -p
Enter password: 
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2)

root@:francesco$ ls -al /var/run/mysql/ 
total 8
drwxr-xr-x  2 mysql mysql 4096 Jul  3 19:22 .
drwxr-xr-x 27 root  root  4096 Jul  3 19:20 ..

root@:francesco$ mysql_install_db --user=francesco
Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h darkstar password 'new-password'

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/bin/mysqlbug script!


Leggendo /var/lib/mysql/darkstar.err, trovo i seguenti errori

Codice: Seleziona tutto

root@:francesco$ cat /var/lib/mysql/darkstar.err | grep ERROR
120630  9:22:39 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
120630  9:22:41 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
120703  9:47:28 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
120703  9:47:31 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
120703 19:20:52 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
120703 19:20:56 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
120703 19:22:53 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
120703 19:22:54 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
Come posso aggiungere mysql.host???

GraZie Francesco

Avatar utente
ermes
Linux 2.x
Linux 2.x
Messaggi: 372
Iscritto il: dom 20 feb 2005, 0:00
Slackware: current 64
Desktop: kde
Località: Rho (Mi)

Re: Problema MySql

Messaggio da ermes »

non vorrei sbagliare ma credo che vi manchi il cambio di owner e gruppo alle directory /var/run/mysql/ prima di lanciare il "mysql_install_db"

se non interpreto male l'inizio del file rc.mysqld i problemi dovrebbero essere risolti con il seguente comando:
#cd /var/run/
#chown -R mysql mysq

io poi mi ricordo che avevo eseguito anche questo:
#chgrp -R mysql mysq

ciao

Avatar utente
targzeta
Iper Master
Iper Master
Messaggi: 6629
Iscritto il: gio 3 nov 2005, 14:05
Nome Cognome: Emanuele Tomasi
Slackware: 64-current
Kernel: latest stable
Desktop: IceWM
Località: Carpignano Sal. (LE) <-> Pisa

Re: Problema MySql

Messaggio da targzeta »

Ma hai provato ad eseguire

Codice: Seleziona tutto

mysql_upgrade
come scritto nel log? Dovrevve risolvere lui questi problemi.

Emanuele
Se pensi di essere troppo piccolo per fare la differenza, prova a dormire con una zanzara -- Dalai Lama

Avatar utente
darkstaring
Linux 3.x
Linux 3.x
Messaggi: 657
Iscritto il: mer 13 ott 2010, 13:55
Nome Cognome: Francesco Achenza
Desktop: KDE
Distribuzione: Arch Linux
Contatta:

Re: Problema MySql

Messaggio da darkstaring »

Ho provato ad eseguire entrambi i comandi ma sembra non andare anzi gli errori sono aumentati:

Codice: Seleziona tutto

root@:run$ cat /var/lib/mysql/darkstar.err | grep ERROR
120630  9:22:39 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
120630  9:22:41 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
120703  9:47:28 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
120703  9:47:31 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
120703 19:20:52 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
120703 19:20:56 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
120703 19:22:53 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
120703 19:22:54 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
120703 21:54:46 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
120703 21:54:48 [ERROR] /usr/libexec/mysqld: Can't find file: './mysql/host.frm' (errno: 13)
120703 21:54:48 [ERROR] Fatal error: Can't open and lock privilege tables: Can't find file: './mysql/host.frm' (errno: 13)
120703 22:03:14 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
120703 22:03:16 [ERROR] /usr/libexec/mysqld: Can't find file: './mysql/host.frm' (errno: 13)
120703 22:03:16 [ERROR] Fatal error: Can't open and lock privilege tables: Can't find file: './mysql/host.frm' (errno: 13)
120703 22:03:54 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
120703 22:03:56 [ERROR] /usr/libexec/mysqld: Can't find file: './mysql/host.frm' (errno: 13)
120703 22:03:56 [ERROR] Fatal error: Can't open and lock privilege tables: Can't find file: './mysql/host.frm' (errno: 13)
120703 22:06:09 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
120703 22:06:11 [ERROR] /usr/libexec/mysqld: Can't find file: './mysql/host.frm' (errno: 13)
120703 22:06:11 [ERROR] Fatal error: Can't open and lock privilege tables: Can't find file: './mysql/host.frm' (errno: 13)
Ho eseguito i comandi detti da voi, ho cambiato solo il comando
#chown -R mysql mysq
in
#chown -R mysql mysql

Codice: Seleziona tutto

root@:run$ sh /etc/rc.d/rc.mysqld restart

root@:run$ 120703 22:06:09 mysqld_safe Logging to '/var/lib/mysql/darkstar.err'.
120703 22:06:09 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
120703 22:06:11 mysqld_safe mysqld from pid file /var/run/mysql/mysql.pid ended


root@:run$ mysql_upgrade 
Looking for 'mysql' as: mysql
Looking for 'mysqlcheck' as: mysqlcheck
Running 'mysqlcheck with default connection arguments
mysqlcheck: Got error: 2002: Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2) when trying to connect
FATAL ERROR: Upgrade failed

Avatar utente
darkstaring
Linux 3.x
Linux 3.x
Messaggi: 657
Iscritto il: mer 13 ott 2010, 13:55
Nome Cognome: Francesco Achenza
Desktop: KDE
Distribuzione: Arch Linux
Contatta:

Re: Problema MySql

Messaggio da darkstaring »

Nessuno sà aiutarmi?
Posto l'output dei vari permessi e gruppi

Codice: Seleziona tutto

root@:etc$ ls -al /var/run/ | grep mysql
drwxr-xr-x  2 mysql     mysql     4096 Jul  5 10:26 mysql

root@:etc$ cat passwd group | grep mys
mysql:x:27:27:MySQL:/var/lib/mysql:/bin/false
mysql:x:27:

In /etc/mysql non trovo un file di configurazione e non riesco ad andare avanti...
Ho eliminato la directory che conteneva i database e non la trovo più.. mi date il percorso???"
vorrei controllare i permessi...
:evil:

Cosa posso fare? mi servirebbe now() :)

Rispondi