2012年5月26日 星期六

5/29 還是發生一樣問題:
[root@howy ~]# service mysqld status
mysqld 已停止執行但 subsys 被鎖定
決定先關閉自動備份功能
有空再試試看這個方式
http://bbs.nsysu.edu.tw/txtVersion/boards/linux/M.1189311466.AI.html

___________________________
早起床發現網站
Can't connect to local MySQL server through socket


檢查log:
vi /var/log/mysqld.log
tail -n 20 /var/log/mysqld.log

InnoDB: using the same InnoDB data or log files.


120521  4:47:54  InnoDB: Unable to open the first data file
InnoDB: Error in opening ./ibdata1
120521  4:47:54  InnoDB: Operating system error number 11 in a file operation.
InnoDB: Error number 11 means 'Resource temporarily unavailable'.
InnoDB: Some operating system error numbers are described at
InnoDB: http://dev.mysql.com/doc/refman/5.1/en/operating-system-error-codes.html
InnoDB: Could not open or create data files.
InnoDB: If you tried to add new data files, and it failed here,
InnoDB: you should now edit innodb_data_file_path in my.cnf back
InnoDB: to what it was, and remove the new ibdata files InnoDB created
InnoDB: in this failed attempt. InnoDB only wrote those files full of
InnoDB: zeros, but did not yet use them in any way. But be careful: do not
InnoDB: remove old data files which contain your precious data!
120521  4:47:54 [ERROR] Plugin 'InnoDB' init function returned error.
120521  4:47:54 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
120521  4:47:54 [ERROR] Can't start server: Bind on TCP/IP port: Address already in use
120521  4:47:54 [ERROR] Do you already have another mysqld server running on port: 3306 ?
120521  4:47:54 [ERROR] Aborting
120521  4:47:54 [Note] /usr/libexec/mysqld: Shutdown complete
120521 04:47:54 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
120521 04:47:56 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
120521  4:47:57  InnoDB: Initializing buffer pool, size = 8.0M
120521  4:47:57  InnoDB: Completed initialization of buffer pool
InnoDB: Unable to lock ./ibdata1, error: 11



先用這方法 (暫時恢復運作)
http://www.neo.com.tw/archives/92

發生找不到 mysql.sock 的處理方法!Posted by Neo on 三月 - 16 - 2004
9 Comments出現以下的訊息:
Got an error: Connection error: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'
mysql.sock 突然消失算是常見的問題,如果是第一次安裝MySQL才出現,那只要找出 mysql.sock 在哪裡就可以了。
以上述的錯誤訊息,mysql.sock 應該是在 /var/lib/mysql/ 裡面 ,如果沒有的話,就下:
#find / -name mysql.sock
來找看看放在哪裡,找到之後再下:
#mysqladmin -S /找到路徑/mysql.sock -u root {參數}
那...如果是突然不見的,或是都找不到怎麼辦?
那只好重新啟動 mysql 了,tarball 安裝可以透過 mysqld 或 mysqladmin 重新啟動,rpm 安裝可以透過 service mysql restart 。但是在 mysql.sock 不見的情況下,可能是無法重新啟動 mysql 的,如果真的不行,只好先下:
#ps -aux|grep mysql
再把看到的 pid 先砍了
#kill 看到的pid
確定全部都殺完了,再看一次還有沒有
#ps -aux|grep mysql
確定裡面的 mysql 都沒有了,然後再執行 mysqld 或是 service mysql start 就可以了。

做了兩個設定,過幾天再看看有無再出現問題:

1.嘗試這個指令
I had the same problem with Mysql 4.1.12 after recieving a SELinux update throught the RedHat Network. Editing /etc/selinux/config so the it says:
SELINUX=permissiveFixed my problem.http://www.linuxforums.org/forum/servers/17376-mysql-server-wont-start-port-conflick.html
 改 /etc/selinux/config


# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
#SELINUX=enforcing
SELINUX=permissive
#by Howy 2012/5/27

# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted



2.參考IBM網站
http://www-900.ibm.com/cn/support/viewdoc/detail?DocId=2011073000000執行:
mysql_install_db相关介绍http://hi.baidu.com/ostech/blog/item/6f838f7c1b3d00330dd7da38.html
[root@howy ~]# mysql_install_db
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 howy.tw 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!

再看看log
[root@howy howy]# tail -n 20 /var/log/mysqld.log
120527  9:56:48  InnoDB: Completed initialization of buffer pool
120527  9:56:49  InnoDB: Started; log sequence number 0 44233
120527  9:56:49 [Note] Event Scheduler: Loaded 0 events
120527  9:56:49 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.1.61'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  Source distribution
120527 11:08:19 [Note] /usr/libexec/mysqld: Normal shutdown
120527 11:08:19 [Note] Event Scheduler: Purging the queue. 0 events
120527 11:08:19  InnoDB: Starting shutdown...
120527 11:08:23  InnoDB: Shutdown completed; log sequence number 0 44233
120527 11:08:23 [Note] /usr/libexec/mysqld: Shutdown complete
120527 11:08:23 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
120527 11:09:08 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
120527 11:09:08  InnoDB: Initializing buffer pool, size = 8.0M
120527 11:09:08  InnoDB: Completed initialization of buffer pool
120527 11:09:09  InnoDB: Started; log sequence number 0 44233
120527 11:09:09 [Note] Event Scheduler: Loaded 0 events
120527 11:09:09 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.1.61'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  Source distribution



























沒有留言:

張貼留言