Страница 1 из 1

Не запускается MySQL на FreeBSD 8.1

Добавлено: 2011-11-08 12:38:38
tomek
Добрый день.
В продолжение темы: http://forum.lissyara.su/viewtopic.php?f=3&t=34672

Возникла проблема не запускается mysql, в процессах он то появляется, то пропадает(состояние в top постоянно меняется: RUN, STOP,sigwai,ucond) соответственно /tmp/mysql.sock тоже то пропадает, то появляется.

На данный момент конфиг Mysql следующий:

Код: Выделить всё

zabbix# vi  /usr/local/etc/my.cnf
[client]
password =*****
port = 3306
socket = /tmp/mysql.sock
[mysqld]
port = 3306
bind-address = 127.0.0.1
socket = /tmp/mysql.sock
skip-locking
log = /var/log/mysql.log
Разрешение выставлены вроде бы правильно:

Код: Выделить всё

ls -l /tmp/ 
srwxrwxrwx  1 mysql   wheel           0 Nov  8 07:20 mysql.sock 
В логах ничего не вижу:

Код: Выделить всё

cat /var/log/mysql.log 

/usr/local/libexec/mysqld, Version: 5.1.54-log (FreeBSD port: mysql-server-5.1.54_1). started with: 
Tcp port: 3306  Unix socket: /tmp/mysql.sock 
Time                 Id Command    Argument 

Tcp port: 3306  Unix socket: /tmp/mysql.sock 
Time                 Id Command    Argument 
111108  8:41:10     1 Connect   root@localhost on 
                    1 Init DB   zabbix 
                    1 Query     SET NAMES utf8 
                    1 Query     SET CHARACTER SET utf8 
                    1 Query     SELECT * FROM nodes WHERE nodetype=1 ORDER BY no                                                                             deid 
                    1 Query     SELECT u.*,s.*  FROM sessions s,users u WHERE s.                                                                             sessionid='ad55ef12426a0b2a5c5a9343e4d2c375' AND s.status=0 AND s.userid=u.useri                                                                             d AND ((s.lastaccess+u.autologout>1320730870) OR (u.autologout=0)) AND ((u.useri                                                                             d  BETWEEN 000000000000000 AND 099999999999999)) 
                    1 Query     SELECT u.*  FROM users u  WHERE u.alias='guest'                                                                              AND ((u.userid  BETWEEN 000000000000000 AND 099999999999999)) 
                    1 Query     INSERT INTO sessions (sessionid,userid,lastacces                                                                             s,status) VALUES ('3c611ffcb3d92f7a36f69104adee3805',2,1320730870,0) 
                    1 Query     SELECT MAX(g.gui_access) as gui_access  FROM usr                                                                             grp g, users_groups ug  WHERE ug.userid=2 AND g.usrgrpid=ug.usrgrpid 
                    1 Query     SELECT g.usrgrpid  FROM usrgrp g, users_groups u                                                                             g  WHERE ug.userid = 2 AND g.usrgrpid = ug.usrgrpid  AND g.users_status = 1 LIMI                                                                             T 1 OFFSET 0 
                    1 Query     SELECT s.*  FROM sessions s  WHERE s.sessionid='                                                                             3c611ffcb3d92f7a36f69104adee3805' AND s.status=0 AND ((s.userid  BETWEEN 0000000                                                                             00000000 AND 099999999999999)) 
                    1 Query     DELETE FROM sessions WHERE status=1 AND userid='                                                                             2' 

/usr/local/libexec/mysqld, Version: 5.1.54-log (FreeBSD port: mysql-server-5.1.54_1). started with: 
Tcp port: 3306  Unix socket: /tmp/mysql.sock 
Time                 Id Command    Argument 
/usr/local/libexec/mysqld, Version: 5.1.54-log (FreeBSD port: mysql-server-5.1.54_1). started with: 
Tcp port: 3306  Unix socket: /tmp/mysql.sock 
Time                 Id Command    Argument 
/usr/local/libexec/mysqld, Version: 5.1.54-log (FreeBSD port: mysql-server-5.1.54_1). started with: 
Tcp port: 3306  Unix socket: /tmp/mysql.sock 
Time                 Id Command    Argument 
К базам данных в момент когда mysql висит в процессах подключиться можно:

Код: Выделить всё

#mysql -u root -p 
password: ***** 

Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g. 
Your MySQL connection id is 1 
Server version: 5.1.54-log FreeBSD port: mysql-server-5.1.54_1 

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. 
This software comes with ABSOLUTELY NO WARRANTY. This is free software, 
and you are welcome to modify and redistribute it under the GPL v2 license 

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. 

mysql>use zabbix; 
No connection. Trying to reconnect... 
Connection id:    1 
Current database: *** NONE *** 

Reading table information for completion of table and column names 
You can turn off this feature to get a quicker startup with -A 

Database changed 

mysql> show Tables; 
ERROR 2006 (HY000): MySQL server has gone away 
No connection. Trying to reconnect... 
Connection id:    1 
Current database: zabbix 

+-----------------------+ 
| Tables_in_zabbix      | 
+-----------------------+ 
| acknowledges          | 
| actions               | 
| alerts                | 
| applications          | 
| auditlog              | 
| auditlog_details      | 
| autoreg_host          | 
| conditions            | 
| config                | 
| dchecks               | 
| dhosts                | 
| drules                | 
| dservices             | 
| escalations           | 
| events                | 
| expressions           | 
| functions             | 
| globalmacro           | 
| graph_theme           | 
| graphs                | 
| graphs_items          | 
| groups                | 
| help_items            | 
| history               | 
| history_log           | 
| history_str           | 
| history_str_sync      | 
| history_sync          | 
| history_text          | 
| history_uint          | 
| history_uint_sync     | 
| hostmacro             | 
| hosts                 | 
| hosts_groups          | 
| hosts_profiles        | 
| hosts_profiles_ext    | 
| hosts_templates       | 
| housekeeper           | 
| httpstep              | 
| httpstepitem          | 
| httptest              | 
| httptestitem          | 
| ids                   | 
| images                | 
| items                 | 
| items_applications    | 
| maintenances          | 
| maintenances_groups   | 
| maintenances_hosts    | 
| maintenances_windows  | 
| mappings              | 
| media                 | 
| media_type            | 
| node_cksum            | 
| nodes                 | 
| opconditions          | 
| operations            | 
| opmediatypes          | 
| profiles              | 
| proxy_autoreg_host    | 
| proxy_dhistory        | 
| proxy_history         | 
| regexps               | 
| rights                | 
| screens               | 
| screens_items         | 
| scripts               | 
| service_alarms        | 
| services              | 
| services_links        | 
| services_times        | 
| sessions              | 
| slides                | 
| slideshows            | 
| sysmaps               | 
| sysmaps_elements      | 
| sysmaps_link_triggers | 
| sysmaps_links         | 
| timeperiods           | 
| trends                | 
| trends_uint           | 
| trigger_depends       | 
| triggers              | 
| user_history          | 
| users                 | 
| users_groups          | 
| usrgrp                | 
| valuemaps             | 
+-----------------------+ 
88 rows in set (0.20 sec) 

И соответственно когда он не запущен:

Код: Выделить всё


# mysql -u root -p 
Enter password: *****
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

Re: Не запускается MySQL на FreeBSD 8.1

Добавлено: 2011-11-08 12:41:35
Gamerman
не те логи. покажите, что в файле /var/db/mysql/{$hostname}.err

Re: Не запускается MySQL на FreeBSD 8.1

Добавлено: 2011-11-08 13:32:54
tomek
Вот часть логов, спасибо за наводку:

Код: Выделить всё

111108 14:30:23 mysqld_safe mysqld restarted
111108 14:30:24 [Warning] '--log' is deprecated and will be removed in a future release. Please use ''--general_log'/'--general_log_file'' instead.
111108 14:30:24 [Note] Plugin 'FEDERATED' is disabled.
111108 14:30:25  InnoDB: Initializing buffer pool, size = 8.0M
111108 14:30:25  InnoDB: Completed initialization of buffer pool
111108 14:30:25  InnoDB: ERROR: We were only able to scan the log up to
InnoDB: 43 3301132288, but a checkpoint was at 43 3301132733.
InnoDB: It is possible that the database is now corrupt!
111108 14:30:26  InnoDB: Error: page 1 log sequence number 43 3301132919
InnoDB: is in the future! Current system log sequence number 43 3301132733.
InnoDB: Your database may be corrupt or you may have copied the InnoDB
InnoDB: tablespace but not the InnoDB log files. See
InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html
InnoDB: for more information.
111108 14:30:26  InnoDB: Error: page 4 log sequence number 43 3301134629
InnoDB: is in the future! Current system log sequence number 43 3301132733.
InnoDB: Your database may be corrupt or you may have copied the InnoDB
InnoDB: tablespace but not the InnoDB log files. See
InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html
InnoDB: for more information.
InnoDB: 1 transaction(s) which must be rolled back or cleaned up
InnoDB: in total 65 row operations to undo
InnoDB: Trx id counter is 0 201844480
111108 14:30:26  InnoDB: Started; log sequence number 43 3301132733
InnoDB: Starting in background the rollback of uncommitted transactions
InnoDB: Cleaning up trx with id 0 201846510
111108 14:30:26  InnoDB: Rollback of non-prepared transactions completed
111108 14:30:27 [Note] Event Scheduler: Loaded 0 events
111108 14:30:27 [Note] /usr/local/libexec/mysqld: ready for connections.
Version: '5.1.54-log'  socket: '/tmp/mysql.sock'  port: 3306  FreeBSD port: mysql-server-5.1.54_1
111108 14:30:27  InnoDB: Error: page 114691 log sequence number 43 3301134646
InnoDB: is in the future! Current system log sequence number 43 3301132733.
InnoDB: Your database may be corrupt or you may have copied the InnoDB
InnoDB: tablespace but not the InnoDB log files. See
InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html
InnoDB: for more information.
111108 14:30:27  InnoDB: Error: page 294913 log sequence number 43 3301134103
InnoDB: is in the future! Current system log sequence number 43 3301132733.
InnoDB: Your database may be corrupt or you may have copied the InnoDB
InnoDB: tablespace but not the InnoDB log files. See
InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html
InnoDB: for more information.
111108 14:30:27  InnoDB: Error: page 65562 log sequence number 43 3301134696
InnoDB: is in the future! Current system log sequence number 43 3301132750.
InnoDB: Your database may be corrupt or you may have copied the InnoDB
InnoDB: tablespace but not the InnoDB log files. See
InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html
InnoDB: for more information.
111108 14:30:27  InnoDB: Error: page 32769 log sequence number 43 3301134424
InnoDB: is in the future! Current system log sequence number 43 3301132750.
InnoDB: Your database may be corrupt or you may have copied the InnoDB
InnoDB: tablespace but not the InnoDB log files. See
InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html
InnoDB: for more information.
111108 14:30:27  InnoDB: Error: page 278529 log sequence number 43 3301134646
InnoDB: is in the future! Current system log sequence number 43 3301132912.
InnoDB: Your database may be corrupt or you may have copied the InnoDB
InnoDB: tablespace but not the InnoDB log files. See
InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html
InnoDB: for more information.
111108 14:30:27  InnoDB: Error: page 147465 log sequence number 43 3301134629
InnoDB: is in the future! Current system log sequence number 43 3301132920.
InnoDB: Your database may be corrupt or you may have copied the InnoDB
InnoDB: tablespace but not the InnoDB log files. See
InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html
InnoDB: for more information.
111108 14:30:27  InnoDB: Assertion failure in thread 709101056 in file btr/btr0pcur.c line 402
InnoDB: Failing assertion: btr_page_get_prev(next_page, mtr) == buf_frame_get_page_no(page)
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html
InnoDB: about forcing recovery.
111108 14:30:27 - mysqld got signal 6 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help diagnose
the problem, but since we have already crashed, something is definitely wrong
and this may fail.

key_buffer_size=8384512
read_buffer_size=131072
max_used_connections=0
max_threads=151
threads_connected=0
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 337711 K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.
Я как понимаю ему не нравится База данных, он думает что она подменена. Дело в том что этот сервер был полностью клонирован с помощью dump=>restore. Как данные ошибки можно обойти?? Или я не правильно понял суть проблемы?

Re: Не запускается MySQL на FreeBSD 8.1

Добавлено: 2011-11-08 13:55:48
Gamerman
Можно грохнуть файлы журналов Иннодб

Re: Не запускается MySQL на FreeBSD 8.1

Добавлено: 2011-11-08 14:15:24
GhOsT_MZ
tomek писал(а):Вот часть логов, спасибо за наводку:

Код: Выделить всё

111108 14:30:26  InnoDB: Error: page 1 log sequence number 43 3301132919
InnoDB: is in the future! Current system log sequence number 43 3301132733.
InnoDB: Your database may be corrupt or you may have copied the InnoDB
InnoDB: tablespace but not the InnoDB log files. See
InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html
InnoDB: for more information.
Я как понимаю ему не нравится База данных, он думает что она подменена. Дело в том что этот сервер был полностью клонирован с помощью dump=>restore. Как данные ошибки можно обойти?? Или я не правильно понял суть проблемы?
Ну так насколько помню, InnoDB не любит, когда ее так клонируют... ей нужен mysqldump, но уж никак не dump... А вообще, можно попробовать repair таблиц сделать, может спасет

Re: Не запускается MySQL на FreeBSD 8.1

Добавлено: 2011-11-08 14:16:12
tomek
Имеется в виду ibdate1? там же хранятся данные базы, насколько я знаю.

Re: Не запускается MySQL на FreeBSD 8.1

Добавлено: 2011-11-08 14:25:18
Gamerman
там 3 файла. В одном данные, в других двух - журналы. Названия не помню.

Re: Не запускается MySQL на FreeBSD 8.1

Добавлено: 2012-03-01 14:31:50
Vlad5503
Имееться Freebsd 8.1, из портов поставил mysql50-server и клиента.
Установка сервера прошла без запинки (ставил первый раз), не вывалилось ни одной ошибки.
Вот его конфиг:

Код: Выделить всё

[client]
port            = 3306
socket          = /tmp/mysql.sock

[mysqld]
port            = 3306
socket          = /tmp/mysql.sock
bind-address    = 127.0.0.1
skip-locking
innodb_data_home_dir = /var/db/mysql/
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = /var/db/mysql/
innodb_buffer_pool_size = 16M
innodb_additional_mem_pool_size = 2M
innodb_log_file_size = 5M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50
key_buffer_size = 16M
max_allowed_packet = 1M
table_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
skip-networking
log-bin=mysql-bin

[mysqldump]
quick
max_allowed_packet = 16M

[mysql]
no-auto-rehash

[myisamchk]
key_buffer_size = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M

[mysqlhotcopy]
interactive-timeout

[mysqld]
log=/var/log/mysql.log
Но вот стартовать не хочет в директории /var/db/mysql создались:

Код: Выделить всё

# cd /var/db/mysql
# ls
mysql                   mysql-bin.000001        mysql-bin.000002        mysql-bin.index         test
В директории /var/db/mysql/mysql имеется:

Код: Выделить всё

# ls
columns_priv.MYD                help_keyword.MYI                proc.frm                        time_zone_name.MYD
columns_priv.MYI                help_keyword.frm                procs_priv.MYD                  time_zone_name.MYI
columns_priv.frm                help_relation.MYD               procs_priv.MYI                  time_zone_name.frm
db.MYD                          help_relation.MYI               procs_priv.frm                  time_zone_transition.MYD
db.MYI                          help_relation.frm               tables_priv.MYD                 time_zone_transition.MYI
db.frm                          help_topic.MYD                  tables_priv.MYI                 time_zone_transition.frm
func.MYD                        help_topic.MYI                  tables_priv.frm                 time_zone_transition_type.MYD
func.MYI                        help_topic.frm                  time_zone.MYD                   time_zone_transition_type.MYI
func.frm                        host.MYD                        time_zone.MYI                   time_zone_transition_type.frm
help_category.MYD               host.MYI                        time_zone.frm                   user.MYD
help_category.MYI               host.frm                        time_zone_leap_second.MYD       user.MYI
help_category.frm               proc.MYD                        time_zone_leap_second.MYI       user.frm
help_keyword.MYD                proc.MYI                        time_zone_leap_second.frm
В логе /var/log/mysql.log есть:

Код: Выделить всё

Tcp port: 3306  Unix socket: /tmp/mysql.sock
Time                 Id Command    Argument
/usr/local/libexec/mysqld, Version: 5.0.92-log (FreeBSD port: mysql-server-5.0.92). started with:
Tcp port: 0  Unix socket: /tmp/mysql.sock
Time                 Id Command    Argument
Подскажите где искать, что проверить?

Re: Не запускается MySQL на FreeBSD 8.1

Добавлено: 2012-03-01 14:38:39
Gamerman
C чего вывод, что стартовать не хочет?

Re: Не запускается MySQL на FreeBSD 8.1

Добавлено: 2012-03-01 15:04:36
Vlad5503
честно?
сам пока не "догнал"
выясняю вот...
сменил параметры /etc/make.conf
деинсталировал мускул сервер и клиент.
заново начал make && make install && make clean как для сервера, так для клиента.

Re: Не запускается MySQL на FreeBSD 8.1

Добавлено: 2012-03-01 15:08:46
Gamerman
так в чем проблема?

Re: Не запускается MySQL на FreeBSD 8.1

Добавлено: 2012-03-02 5:33:13
Vlad5503
Проблема в том, что mysql не стартует, вернее даешь команду /usr/local/etc/mysql-server start, повяляеться надпись Mysql starting, ожидание примерно 20 сек. и всё. Больше ничего не появляется. В процессах его нет, базы созданы, как мне подсказали частично, т.е. не все.
На другом серваке ставил мускул он хоть ругался при сборке/установке. Подправили и заработал(фря там стоит 8.0).

Re: Не запускается MySQL на FreeBSD 8.1

Добавлено: 2012-03-02 10:22:20
Gamerman
Инфу о работе/неработе мускуля можно почерпнуть с файла /var/db/mysql/${hostname}.err

Re: Не запускается MySQL на FreeBSD 8.1

Добавлено: 2012-03-02 13:22:10
Vlad5503
да еслиб был это файл /var/db/mysql/${hostname}.err !!!
нет его, нечего увидеть про ошибки....

Re: Не запускается MySQL на FreeBSD 8.1

Добавлено: 2012-03-05 7:07:56
Vlad5503
Может у кого есть идеи, почему отказывается стартовать мускул..?
Я ужо голову сломал, и выключить сервер, вернее перегрузить пока не имею возможности, стоит на отвественном узле. А тут возникла потребность поднять на нему мускул....

Re: Не запускается MySQL на FreeBSD 8.1

Добавлено: 2012-03-15 8:01:10
Vlad5503
Странно.. ну неужто некому подсказать?
Пробовал вот сегодня стартануть мускул..

Код: Выделить всё

# /usr/local/bin/mysql start
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
Такого файла нет в директории temp.

Re: Не запускается MySQL на FreeBSD 8.1

Добавлено: 2012-03-15 8:05:46
GhOsT_MZ
Какие права на /tmp? Должны быть 777 (chmod 777 /tmp).

Re: Не запускается MySQL на FreeBSD 8.1

Добавлено: 2012-03-15 11:24:03
Bayerische
Дайте вывод

Код: Выделить всё

#cat /var/db/mysql/*.err

Re: Не запускается MySQL на FreeBSD 8.1

Добавлено: 2012-03-15 11:29:42
Vlad5503
так и есть. права на директорию 777 стоят.
по команде #cat /var/db/mysql/*.err
ничего не выводиться.
т.к. нет файлов таких вообще....

Re: Не запускается MySQL на FreeBSD 8.1

Добавлено: 2012-03-15 11:31:58
Gamerman
Я бы посоветовал убрать все конф-файли мускульные, пусть стартует по умолчанию.

Re: Не запускается MySQL на FreeBSD 8.1

Добавлено: 2012-03-15 13:24:31
Bayerische

Код: Выделить всё

# ls -l /var/db | grep mysql
Надо, чтобы овнером mysql был.

Re: Не запускается MySQL на FreeBSD 8.1

Добавлено: 2012-03-16 5:53:49
Vlad5503
?
Пожалуйста, объясните мне, слово овнером.
В директории создались пустые папки

Код: Выделить всё

/var/db/mysql 
и

Код: Выделить всё

/var/db/test
.

Re: Не запускается MySQL на FreeBSD 8.1

Добавлено: 2012-03-16 6:09:23
Vlad5503
owner владелец папки.
так и есть у меня.
# ls -l /var/db/mysql
total 4
drwx------ 2 root mysql 512 Mar 15 16:40 mysql
drwx------ 2 root mysql 512 Mar 15 16:40 test

Re: Не запускается MySQL на FreeBSD 8.1

Добавлено: 2012-03-16 19:08:17
FiL
у тебя владелец root, a не mysql. Это таки проблема.

Re: Не запускается MySQL на FreeBSD 8.1

Добавлено: 2012-03-18 9:11:32
Vlad5503
Да, действительно.
в результате переустановок нескольких версий пришли к тому, что сервер н применил права mysql mysql к указанным папкам.
Пичем интересное было то, что вручную сменил права, на следующий день увидел что права опять такие как до смены.
мистика....
Ну в общем мускул заработал.
Всем спасибо за оказанную в любом виде помощь.