Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2154315
  • 博文数量: 157
  • 博客积分: 10047
  • 博客等级: 上将
  • 技术积分: 6757
  • 用 户 组: 普通用户
  • 注册时间: 2005-05-19 11:38
文章分类

全部博文(157)

文章存档

2011年(16)

2010年(50)

2009年(42)

2008年(49)

我的朋友

分类: Mysql/postgreSQL

2009-03-23 16:06:46

 
java在调用mysql的时候出现错误如下:

2009-03-23 09:02:10,260 ERROR [com.chinacache.logpublish.service.TaskProcessor@a02839] -
2009-03-23 09:02:10,265 ERROR [com.chinacache.logpublish.TaskFlow@16ff2d9] -
解决方法:
1、登陆mysql数据库
[root@MySQL ~]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 74316
Server version: 5.0.45 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| LOG                |
| mysql              |
| test               |
+--------------------+
4 rows in set (0.00 sec)
mysql> use LOG
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;
+----------------+
| Tables_in_LOG  |
+----------------+
| PUBLISHURL     |
| PUBLISHURL_NEW |
+----------------+
2 rows in set (0.00 sec)
2、检查表的健康状况
mysql> check table PUBLISHURL_NEW;
+--------------------+-------+----------+----------------------------------------------------------+
| Table              | Op    | Msg_type | Msg_text                                                 |
+--------------------+-------+----------+----------------------------------------------------------+
| LOG.PUBLISHURL_NEW | check | warning  | Table is marked as crashed                               |
| LOG.PUBLISHURL_NEW | check | warning  | 2 clients are using or haven't closed the table properly |
| LOG.PUBLISHURL_NEW | check | error    | Can't read key from filepos: 7356416                     |
| LOG.PUBLISHURL_NEW | check | error    | Corrupt                                                  |
+--------------------+-------+----------+----------------------------------------------------------+
4 rows in set, 1 warning (0.15 sec)
mysql> exit
Bye
3、由于有程序在使用,关闭数据库断开连接,对于生产库不建议这样做
[root@MySQL ~]# service mysqld restart;
Stopping MySQL:                                            [  OK  ]
Starting MySQL:                                            [  OK  ]
[root@MySQL ~]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.0.45 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> use LOG
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
4、检查完成
mysql> check table PUBLISHURL_NEW;
+--------------------+-------+----------+--------------------------------------------------------------------------+
| Table              | Op    | Msg_type | Msg_text                                                                 |
+--------------------+-------+----------+--------------------------------------------------------------------------+
| LOG.PUBLISHURL_NEW | check | error    | Table './LOG/PUBLISHURL_NEW' is marked as crashed and should be repaired |
+--------------------+-------+----------+--------------------------------------------------------------------------+
1 row in set (0.00 sec)
5、修复成功
mysql> repair table PUBLISHURL_NEW;
+--------------------+--------+----------+-------------------------------------------------+
| Table              | Op     | Msg_type | Msg_text                                        |
+--------------------+--------+----------+-------------------------------------------------+
| LOG.PUBLISHURL_NEW | repair | info     | Wrong bytesec:   0-  0-  0 at 24324356; Skipped |
| LOG.PUBLISHURL_NEW | repair | warning  | Number of rows changed from 166555 to 166462    |
| LOG.PUBLISHURL_NEW | repair | status   | OK                                              |
+--------------------+--------+----------+-------------------------------------------------+
3 rows in set (3.67 sec)
6、检查修复后的结果,大功告成
mysql>  check table PUBLISHURL_NEW;
+--------------------+-------+----------+----------+
| Table              | Op    | Msg_type | Msg_text |
+--------------------+-------+----------+----------+
| LOG.PUBLISHURL_NEW | check | status   | OK       |
+--------------------+-------+----------+----------+
1 row in set (0.67 sec)
mysql>
阅读(1743) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~