legat de mysql

19 posts / 0 new
Last post
Marius Sirbu
legat de mysql

Salut
Am o problema mare si poate reusesc s-o rezolv cu ajutorul vostru:
am un server web si un site realizat cu ajutorul unui cms. Acest cms foloseste mysql ca si server de baze de date....
problema mea este ca nu ma mai pot conecta la server, zice ceva de genul: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2).
Exista vre-o metoda de a rezolva problema fara reinstalarea serverului mysql?
Multumesc anticipat

admin
admin's picture
Re: legat de mysql

ls -al /var/lib/mysql/mysql.sock ce zice? mysql e pornit?
Sper ca ai creat o baza de date si un user cu privilegii de scriere in ea ;D

Marius Sirbu
Re: legat de mysql

ls: /var/lib/mysql/mysql.sock: No such file or directory
:(

Serverul a functionat pina ieri, cind, din graba si viteza am sters (mai mult decit probabil) mysql.sock
Pot recupara cumva acel fisier?

???

Marius
-----------------------------------------
Linux registered user # 419668

ing. Patkos Csaba
ing. Patkos Csaba's picture
Re: legat de mysql

Am facut un test:
- am sters /var/lib/mysql/mysql.sock
- am repornint /etc/rc.d/init.d/mysqld
- socketul a fost creat inapoi

Vezi in /etc/my.cnf sa i pusa liniile de socket. La mine un "cat /etc/my.cnf | grep sock" returneaza asta:
[root@localhost mysql]# cat /etc/my.cnf | grep sock
socket          = /var/lib/mysql/mysql.sock
socket          = /var/lib/mysql/mysql.sock
# All interaction with mysqld must be made via Unix sockets or named pipes.
socket=/var/lib/mysql/mysqlmanager.sock

Sper sa-ti iasa, bafta.

Csabi's BLOG

Linux registered user # 457717

admin
admin's picture
Re: legat de mysql

fisierul ala se creeaza de fiecare data cand pornesti mysql
ps aux|grep mysql ce zice? mysql ruleaza?

Marius Sirbu
Re: legat de mysql

La comanda:
[marius@marius cdrom]$ mysql -umarius -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
[marius@marius /home/marius/a]$

ps aux|grep mysql
mysql    3673  0.0  0.1  6160  676 ?        Ss  11:01  0:00 /usr/sbin/mysqlmanager --default-mysqld-path=/usr/sbin/mysqld --user=mysql --run-as-service --pid-file=/var/run/mysqld/mysqlmanager.pid
mysql    3674  0.0  0.2  14516  1068 ?        Sl  11:01  0:00 /usr/sbin/mysqlmanager --default-mysqld-path=/usr/sbin/mysqld --user=mysql --run-as-service --pid-file=/var/run/mysqld/mysqlmanager.pid
root    14107  0.0  0.0  1764  476 pts/4    R+  14:20  0:00 grep --color mysql

Marius
-----------------------------------------
Linux registered user # 419668

Marius Sirbu
Re: legat de mysql

Uite ce primesc acuma:

[root@marius marius]# /etc/rc.d/init.d/mysqld start
Starting MySQL:                                                [  OK  ]
[root@marius marius]#     

mysql -umarius -pxxx
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
[marius@marius cdrom]$

Marius
-----------------------------------------
Linux registered user # 419668

Marius Sirbu
Re: legat de mysql

acelasi text il primesc si eu la comanda:
cat /etc/my.cnf | grep sock

[marius@marius cdrom]$ cat /etc/my.cnf | grep sock
socket          = /var/lib/mysql/mysql.sock
socket          = /var/lib/mysql/mysql.sock
# All interaction with mysqld must be made via Unix sockets or named pipes.
socket=/var/lib/mysql/mysqlmanager.sock
[marius@marius cdrom]$

Marius
-----------------------------------------
Linux registered user # 419668

admin
admin's picture
Re: legat de mysql

aha, foarte ciudat, deci mysql merge, in my.cnf e definit socketul, dar el nu exista.
ia vezi, exista /tmp/mysql.sock?

Marius Sirbu
Re: legat de mysql

Da Maxx, exact aeleasi linii ca si la tine... :(

Marius
-----------------------------------------
Linux registered user # 419668

admin
admin's picture
Re: legat de mysql

tail -f /var/log/mysqld/mysqlmanager.log zice ceva?

Marius Sirbu
Re: legat de mysql

nu, nu exista /tmp/mysql.sock

Marius
-----------------------------------------
Linux registered user # 419668

Marius Sirbu
Re: legat de mysql

^G/usr/sbin/mysqld: File './mysql-bin.000207' not found (Errcode: 2)
071120 11:39:36 [ERROR] Failed to open log (file './mysql-bin.000207', errno 2)
071120 11:39:36 [ERROR] Could not open log file
071120 11:39:36 [ERROR] Can't init tc log
071120 11:39:36 [ERROR] Aborting

071120 11:39:36  InnoDB: Starting shutdown...
071120 11:39:38  InnoDB: Shutdown completed; log sequence number 0 43805
071120 11:39:38 [Note] /usr/sbin/mysqld: Shutdown complete

071120 14:24:20 Angel pid file: '/var/run/mysqld/mysqlmanager.angel.pid'; PID: 14309.
071120 14:24:20 IM pid file: '/var/run/mysqld/mysqlmanager.pid'; PID: 14310.
071120 14:24:20 guardian: starting instance mysqld
071120 14:24:20 starting instance mysqld
071120 14:24:20 Listener_thread::run(): bind(ip socket) failed, 'Address already in use'
071120 14:24:20  InnoDB: Started; log sequence number 0 43805
^G/usr/sbin/mysqld: File './mysql-bin.000207' not found (Errcode: 2)
071120 14:24:20 [ERROR] Failed to open log (file './mysql-bin.000207', errno 2)
071120 14:24:20 [ERROR] Could not open log file
071120 14:24:20 [ERROR] Can't init tc log
071120 14:24:20 [ERROR] Aborting

071120 14:24:20  InnoDB: Starting shutdown...
071120 14:24:23  InnoDB: Shutdown completed; log sequence number 0 43805
071120 14:24:23 [Note] /usr/sbin/mysqld: Shutdown complete

/var/log/mysqld/mysqlmanager.log lines 7613-7644/7644 (END)     

Marius
-----------------------------------------
Linux registered user # 419668

Marius Sirbu
Re: legat de mysql

Probabil ca am sters ceva ce nu trebuia... (din lipsa de spatiu)

Marius
-----------------------------------------
Linux registered user # 419668

admin
admin's picture
Re: legat de mysql

adauga in my.cnf: skip-innodb (banuiesc ca folosesti engine-ul MyISAM)

Marius Sirbu
Re: legat de mysql

Maxx, ai o bere maaaare de la mine
Functioneaza, urraaa
Totusi, ca si "incepator", ce s-a intimplat?

Mersi mult de tot

Marius
-----------------------------------------
Linux registered user # 419668

admin
admin's picture
Re: legat de mysql

probabil ai sters din fisierele alea .bin (care pot creste destul de mari) si atunci nu a mai mers innodb-ul (de care oricum nu prea ai nevoie).

beranger
beranger's picture
Re: legat de mysql

Maaaaaaxx, asta nu este o rezolvare, ci o carpeala. Mie candva mi s-a rezolvat "mai adevarat": http://beranger.org/index.php?page=3k&article=661

Mai exact:
su mysql -c /usr/bin/mysql_install_db

admin
admin's picture
Re: legat de mysql

omu stersese niste fisiere .bin legate de functionarea motorului innodb. in rest db-urile erau ok. mysql_install_db nu reinitializeaza tabelele user si db din baza mysql? asta ar fi fost neplacut.