在线建站培训
?客服
?搜索
您的位置: 维尼斯老虎机 cms韦德老虎机 php168韦德老虎机 查看内容

PHP168 常见数据库连接出错解决办法

2010-12-14 20:24 | 发布者: moke | 栏目:php168韦德老虎机

希望大家通过本帖可自主的处理日常见到的数据库问题。

第一种:
数据库连接出错:INSERT INTO `p8_article_db` (`aid`) VALUES ('68536')
Duplicate entry '68536' for key 'PRIMARY'
1062

解决办法:
在数据库运行这段SQL:
DELETE FROM p8_article_db WHERE aid>68536
-------------------------------------------------------------------------

第二种:
数据库连接出错:SELECT A.*,R.* FROM p8_article A LEFT JOIN p8_reply R ON A.aid=R.aid WHERE A.aid=65 ORDER BY R.rid ASC LIMIT 0,1
Can't create/write to file 'C:WINDOWSTEMP#sql_658_0.MYD' (Errcode: 17)
1

解决办法:
在my.ini中[mysqld]里面添加一行
tmpdir="c:/mysql/temp/" 或将#sql_658_0.MYD删除后再重启Mysql服务
-------------------------------------------------------------------------------------------------

第三种:
数 据库连接出错:SELECT R.*,A.* FROM p8_article A LEFT JOIN p8_reply R ON A.aid=R.aid WHERE A.aid=608 ORDER BY R.topic DESC,R.orderid ASC LIMIT 0,1
Got error 28 from storage engine
1030

解决办法:
清空在my.ini中tmpdir="c:/mysql/temp/"目录下的文件,或者修改tmpdir参数指向具有足够空间目录。
------------------------------------------------------------------------------------------------------------------------------------------

第四种:
数据库连接出错:SELECT * FROM p8_article WHERE fid='2' ORDER BY list DESC LIMIT 8
Got error 127 from table handler
1030

解决办法:
在数据库运行这段SQL:
REPAIR TABLE `p8_article `
-----------------------------------------------

第五种:
数 据库连接出错:SELECT R.*,A.* FROM p8_article A LEFT JOIN p8_reply R ON A.aid=R.aid WHERE A.aid=687 ORDER BY R.topic DESC,R.orderid ASC LIMIT 0,1
Unknown column 'R.orderid' in 'order clause'
1054

解决办法:在数据库运行这段SQL:
ALTER TABLE `p8_reply` ADD `orderid` MEDIUMINT( 8 ) NOT NULL ;
--------------------------------------------------------------------------------------------------

第六种:

数据库连接出错: SELECT * FROM p8_label WHERE lid='1'
Table 'zyp.p8_label' doesn't exist
1146

解决办法:
在数据库运行这段SQL:
CREATE TABLE IF NOT EXISTS `p8_label` (
`lid` int(10) NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL DEFAULT '',
`ch` smallint(4) NOT NULL DEFAULT '0',
`chtype` tinyint(2) NOT NULL DEFAULT '0',
`tag` varchar(50) NOT NULL DEFAULT '',
`type` varchar(30) NOT NULL DEFAULT '',
`typesystem` tinyint(1) NOT NULL DEFAULT '0',
`code` text NOT NULL,
`divcode` text,
`hide` tinyint(1) NOT NULL DEFAULT '0',
`js_time` int(10) NOT NULL DEFAULT '0',
`uid` mediumint(7) NOT NULL DEFAULT '0',
`username` varchar(30) NOT NULL DEFAULT '',
`posttime` int(10) NOT NULL DEFAULT '0',
`pagetype` tinyint(3) NOT NULL DEFAULT '0',
`module` mediumint(6) NOT NULL DEFAULT '0',
`fid` mediumint(7) NOT NULL DEFAULT '0',
`if_js` tinyint(1) NOT NULL DEFAULT '0',
`style` varchar(40) NOT NULL DEFAULT '',
PRIMARY KEY (`lid`),
KEY `ch` (`ch`,`pagetype`,`module`,`fid`,`chtype`),
KEY `tag` (`tag`)
) ENGINE=MyISAM DEFAULT CHARSET=utf-8 AUTO_INCREMENT=1 ;
-------------------------------------------------------------------------------------------------

第七种:
数 据库连接出错:insert into p8_group(usr,groupid,grouptitle,sex,ip,ipfrom,time,where_name,hide,where_id,where_fid,onl_id,sid,url,windows) values ('','','管理员 ','','10.0.0.39','Unknow','1143167041','','','','','','8FWKel5RHLEWStmRoesvu35BSYW6K1uH','http://10.0.0.39/02/index.php','|')
Incorrect integer value: '' for column 'groupid' at row 1
1366

解决办法:
在数据库运行这段SQL:
ALTER TABLE `p8_group` CHANGE `groupid` `groupid` INT( 4 ) NOT NULL AUTO_INCREMENT
-------------------------------------------------------------------------------------------------------------------------------------

第八种:
数据库连接出错:SELECT M.username AS username,M.password AS password,M.salt,D.* FROM `dz`.cdb_uc_members M LEFT JOIN p8_memberdata D ON M.uid=D.uid WHERE M.username='燃灯'
SELECT command denied to user 'aipin'@'localhost' for table 'cdb_uc_members'
1142

解决办法:
比如mysql用户名是root:在数据库运行这段SQL:
REVOKE ALL PRIVILEGES ON * . * FROM'aipin'@'localhost';
GRANT ALL PRIVILEGES ON * . * TO'aipin'@'localhost'WITH GRANT OPTION MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ;
---------------------------------------------------------------------------------------------------------

第九种:
数据库连接出错:SELECT * FROM p8_article WHERE fid='32' AND yz=1 ORDER BY list DESC LIMIT 8
Incorrect key file for table '.sq_biyangwangp8_article.MYI'; try to repair it
126

解决办法:
在数据库运行这段SQL:
REPAIR TABLE `p8_article `
--------------------------------------------------

第十种:
数据库连接出错:SELECT COUNT(id) AS Guestbook FROM p8_guestbook
Can't find file: './kp122799/p8_guestbook.frm' (errno: 13)
1017

解决办法:
或许是权限问题,如mysql用户名是root:在数据库运行这段SQL:
REVOKE ALL PRIVILEGES ON * . * FROM 'root'@'127.0.0.1';
GRANT ALL PRIVILEGES ON * . * TO 'root'@'127.0.0.1' WITH GRANT OPTION MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ;
或重新启动mysql,再不行尝试对其数据表进行修复。
---------------------------------------------------------------------------

第十一种:
数据库连接出错:SELECT COUNT(uid) AS Member FROM p8_members

Table './xianxinbing/p8_members' was created with a different version of MySQL and cannot be read
1033

解决办法:
升级你的Mysql或者修复优化全部相关的数据表。


PS:  学着灵活套用以上出错提示的解决办法即可

查看更多 php168韦德老虎机 php168维尼斯老虎机

最新分享资源

最新评论

验证码 换一个

维尼斯老虎机,韦德老虎机,韦德1946老虎机

百度360搜索搜狗搜索