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
legat de mysql
20. November 2007 - 11:47
#1
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
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
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
fisierul ala se creeaza de fiecare data cand pornesti mysql
ps aux|grep mysql ce zice? mysql ruleaza?
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
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
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
aha, foarte ciudat, deci mysql merge, in my.cnf e definit socketul, dar el nu exista.
ia vezi, exista /tmp/mysql.sock?
Da Maxx, exact aeleasi linii ca si la tine... :(
Marius
-----------------------------------------
Linux registered user # 419668
tail -f /var/log/mysqld/mysqlmanager.log zice ceva?
nu, nu exista /tmp/mysql.sock
Marius
-----------------------------------------
Linux registered user # 419668
^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
Probabil ca am sters ceva ce nu trebuia... (din lipsa de spatiu)
Marius
-----------------------------------------
Linux registered user # 419668
adauga in my.cnf: skip-innodb (banuiesc ca folosesti engine-ul MyISAM)
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
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).
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
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.