推56论坛

 找回密码
 立即注册(限中文)

QQ登录

只需一步,快速开始

查看: 892|回复: 0

[php168教程] PHP168 11种数据库连接出错解决办法

[复制链接]
发表于 2018-3-5 16:32:00 | 显示全部楼层 |阅读模式

  希望大家通过本帖可自主的处理日常见到的数据库问题。
  第一种:
  数据库连接出错: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:\WINDOWS\TEMP\#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=gbk 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_biyangwang\p8_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:  学着灵活套用以上出错提示的解决办法即可                    

本版积分规则

关闭

推56站长论坛推荐上一条 /1 下一条

站长QQ
在线咨询
咨询热线
QQ:405327411
站长

QQ|关于我们|联系我们|免责声明|网站导航|站长论坛 ( 豫ICP备11018337号-5 )

王宝臣旗下网站 推56论坛(www.tui56.com)站长论坛 SEO论坛 网络营销论坛 新手站长论坛 网络推广论坛 站长社区 站长网

Powered by Discuz! X3.4 Licensed

©2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表