Previous Thread
Next Thread
Print Thread
Rate Thread
Common MySQL Errors and Solutions #258490
09/11/2003 2:22 AM
09/11/2003 2:22 AM
Joined: Nov 2001
Posts: 11,330
Charlotte, NC
JoshPet Offline OP
I type Like navaho
JoshPet  Offline OP
I type Like navaho
Joined: Nov 2001
Posts: 11,330
Charlotte, NC
Common SQL Error Codes and Solutions:

If you are receiving this "generic error":

SQL ERROR: Database error only visible to forum administrators

Warning: Supplied argument is not a valid MySQL result resource in /rd1/www/ubbthreads/mysql.inc.php on line 121


or similar, the real error message is being masked. You must first either check your MySQL error logs for the actual error, or edit the mysql.inc.php file to allow it to be displayed, so that you can track down what's wrong.

1. Backup the mysql.inc.php file first.
2. Edit mysql.inc.php file with a text editor
3. Find this near the very bottom:

Code
<br />     if ( ($user['U_Status'] != "Administrator") <br />        &amp;&amp; ( (!stristr($What,"createtable")) &amp;&amp; (!stristr($What,"altertable")) &amp;&amp; (!stristr($What,"ubbimport.php")) ) ) {<br />          $error = "Database error only visible to forum administrators";<br />     }<br />     else {<br />          $this-&gt;errordesc = mysql_error();<br />     }<br />

4. Change to this:
Code
<br />//     if ( ($user['U_Status'] != "Administrator") <br />//        &amp;&amp; ( (!stristr($What,"createtable")) &amp;&amp; (!stristr($What,"altertable")) &amp;&amp; (!stristr($What,"ubbimport.php")) ) ) {<br />//          $error = "Database error only visible to forum administrators";<br />//     }<br />//     else {<br />           $this-&gt;errordesc = mysql_error();<br />//     }<br />


Now the screen will display the actual error, which you can report. Once the problem is resolved, return the mysql.inc.php file to the original state so that errors are not readily displayed to everyone.


Common Errors:

Can't open file: 'w3t_Online.MYI'. (errno: 145)

Error Number 145 = Table was marked as crashed and should be repaired.

Generally this query will fix this:


REPAIR TABLE w3t_Online


*Substitue whatever the table name is for "w3t_Online" above to repair whatever database table is corrupted.


SQL ERROR: Unable to do_query: blah blah blah
Got error 28 from table handler


Error Number 28 = No space left on device


Verify that your webserver or the partition where the database is stored on your server is not out of space. Once this is corrected, you may need to run the REPAIR TABLE command listed above, as corruption sometimes occurs when MySQL attempts to write data to a full drive.


SQL ERROR: Unable to do query: Blah blah blah Got error 127 from table handler

Error 127 = Unknown Error / Record File Crashed


You can generally look at what table or tables it was trying to Query and run the Repair Table command for that table.

For example, if the query throwing the error is the w3t_Posts table, you can try entering this SQL Query:

REPAIR TABLE w3t_Posts


If this does not work, you may need to ask your webhost to run myisamchk on your database. You can also try dumping and restoring the database with the mysqldump command.



If you have more common errors/solutions that should be included here, feel free to post.

Sponsored Links
Re: Common MySQL Errors and Solutions [Re: Daine] #258491
09/11/2003 12:13 PM
09/11/2003 12:13 PM
Joined: Jan 2003
Posts: 364
Poland, Warsaw
S
Slawek_L Offline
Enthusiast
Slawek_L  Offline
Enthusiast
S
Joined: Jan 2003
Posts: 364
Poland, Warsaw
Code
<br />     if ( ($user['U_Status'] != "Administrator") <br />        &amp;&amp; ( (!stristr($What,"createtable")) &amp;&amp; (!stristr($What,"altertable")) &amp;&amp; (!stristr($What,"ubbimport.php")) ) ) {<br />          $error = "Database error only visible to forum administrators";<br />     }<br />     else {<br />          $this-&gt;errordesc = mysql_error();<br />     }<br />

4. Change to this:
Code
<br />//     if ( ($user['U_Status'] != "Administrator") <br />//        &amp;&amp; ( (!stristr($What,"createtable")) &amp;&amp; (!stristr($What,"altertable")) &amp;&amp; (!stristr($What,"ubbimport.php")) ) ) {<br />//          $error = "Database error only visible to forum administrators";<br />//     }<br />//     else {<br />           $this-&gt;errordesc = mysql_error();<br />//     }<br />


I dont see any differnce in this code

Re: Common MySQL Errors and Solutions [Re: Dawg_dup1] #258492
09/11/2003 12:18 PM
09/11/2003 12:18 PM
Joined: Nov 2001
Posts: 11,330
Charlotte, NC
JoshPet Offline OP
I type Like navaho
JoshPet  Offline OP
I type Like navaho
Joined: Nov 2001
Posts: 11,330
Charlotte, NC
Most of it's commented out (note the // ) so that it will display the errors.

Re: Common MySQL Errors and Solutions [Re: Daine] #258493
09/11/2003 12:32 PM
09/11/2003 12:32 PM
Joined: Apr 2002
Posts: 1,929
Virginia, USA
D
Dave_L_dup1 Offline
Addict
Dave_L_dup1  Offline
Addict
D
Joined: Apr 2002
Posts: 1,929
Virginia, USA
Here's an easier way of making that temporary change:

Code
if ([:"red"]FALSE &amp;&amp; [/]($user['U_Status'] != "Administrator") <br />   &amp;&amp; ( (!stristr($What,"createtable")) &amp;&amp; (!stristr($What,"altertable")) &amp;&amp; (!stristr($What,"ubbimport.php")) ) ) {<br />      $error = "Database error only visible to forum administrators";<br />}<br />else {<br />   $this-&gt;errordesc = mysql_error();<br />}

Re: Common MySQL Errors and Solutions [Re: Daine] #258494
09/11/2003 1:24 PM
09/11/2003 1:24 PM
Joined: Jan 2003
Posts: 364
Poland, Warsaw
S
Slawek_L Offline
Enthusiast
Slawek_L  Offline
Enthusiast
S
Joined: Jan 2003
Posts: 364
Poland, Warsaw
[]JoshPet said:
Most of it's commented out (note the // ) so that it will display the errors. [/]


ups

Sponsored Links
Re: Common MySQL Errors and Solutions [Re: joeuser] #258495
09/12/2003 11:20 AM
09/12/2003 11:20 AM
Joined: May 1999
Posts: 8,373
Olympia, WA
R
Rick Offline
Guru
Rick  Offline
Guru
R
Joined: May 1999
Posts: 8,373
Olympia, WA
If you are running version 6.3 or later you can also edit this one line in the not_right function:

$showerror = 0;

If you change that to 1 it will show the mysql errors to all.


UBB.threads Developer
Re: Common MySQL Errors and Solutions [Re: Sally] #258496
09/12/2003 1:30 PM
09/12/2003 1:30 PM
Joined: Nov 2001
Posts: 11,330
Charlotte, NC
JoshPet Offline OP
I type Like navaho
JoshPet  Offline OP
I type Like navaho
Joined: Nov 2001
Posts: 11,330
Charlotte, NC
Oh Awesome..... Good to know.

Re: Common MySQL Errors and Solutions [Re: Daine] #258497
12/21/2003 10:36 PM
12/21/2003 10:36 PM
Joined: Mar 2000
Posts: 227
Alton, MO, USA
C
Chevy454 Offline
Member
Chevy454  Offline
Member
C
Joined: Mar 2000
Posts: 227
Alton, MO, USA
Beginner question for you guys, but I'm trying to learn...

After I run a repair table, I get the below message, but would like to know what it means:

"Resource id #12 row(s) affected by your query."

Re: Common MySQL Errors and Solutions [Re: CPBpnM] #258498
12/21/2003 11:04 PM
12/21/2003 11:04 PM
Joined: Nov 2001
Posts: 11,330
Charlotte, NC
JoshPet Offline OP
I type Like navaho
JoshPet  Offline OP
I type Like navaho
Joined: Nov 2001
Posts: 11,330
Charlotte, NC
That's just a confirmation telling you that the repair worked.

I think it means 12 rows needed to be repaired (or the 12th row). Something like that.

Re: Common MySQL Errors and Solutions [Re: Daine] #258499
12/22/2003 11:31 AM
12/22/2003 11:31 AM
Joined: Mar 2000
Posts: 227
Alton, MO, USA
C
Chevy454 Offline
Member
Chevy454  Offline
Member
C
Joined: Mar 2000
Posts: 227
Alton, MO, USA
Thanks! I was just curious, because I've just now noticed on the last couple of times I've had to repair that it's given me that "resource id #12" mumbo jumbo, and I wasn't for sure if I had an error somewhere that kept repeating. It does keep throwing up the the "error 127" fairly often as of late, whiping out the front page of our forum...isn't that eroor # normally something on the ISP's end?

Sponsored Links
Re: Common MySQL Errors and Solutions [Re: CPBpnM] #258500
12/22/2003 1:14 PM
12/22/2003 1:14 PM
Joined: Nov 2001
Posts: 11,330
Charlotte, NC
JoshPet Offline OP
I type Like navaho
JoshPet  Offline OP
I type Like navaho
Joined: Nov 2001
Posts: 11,330
Charlotte, NC
Yes, I would attribute that to a badly tuned mysql configuration or server.

Re: Common MySQL Errors and Solutions [Re: Daine] #258501
02/05/2004 10:37 PM
02/05/2004 10:37 PM
Joined: Jan 2004
Posts: 99
Portland, Oregon
steelhead Offline
Power User
steelhead  Offline
Power User
Joined: Jan 2004
Posts: 99
Portland, Oregon
I am not seeing any of this code in 6.4.1. I am getting major error messages. And my board is down. What is the code on 6.4.1

Re: Common MySQL Errors and Solutions [Re: Daine] #258502
02/06/2004 12:16 AM
02/06/2004 12:16 AM
Joined: Nov 2001
Posts: 11,330
Charlotte, NC
JoshPet Offline OP
I type Like navaho
JoshPet  Offline OP
I type Like navaho
Joined: Nov 2001
Posts: 11,330
Charlotte, NC
In 6.4.1 he made it even easier.

Find this:
Code
<br />      // IF YOU SET THE VARIABLE BELOW TO 1 IT WILL SHOW THE SQL ERRORS TO ALL<br />      // USERS.  USEFUL IF YOU CANNOT LOG IN AND NEED TO SEE THE SQL ERRORS<br />      $showerror = 0;<br />


Change to this:
Code
<br />      // IF YOU SET THE VARIABLE BELOW TO 1 IT WILL SHOW THE SQL ERRORS TO ALL<br />      // USERS.  USEFUL IF YOU CANNOT LOG IN AND NEED TO SEE THE SQL ERRORS<br />      $showerror = 1;<br />

Re: Common MySQL Errors and Solutions [Re: Daine] #258503
02/06/2004 12:35 AM
02/06/2004 12:35 AM
Joined: Jan 2004
Posts: 99
Portland, Oregon
steelhead Offline
Power User
steelhead  Offline
Power User
Joined: Jan 2004
Posts: 99
Portland, Oregon
Good info to have. thanks

Re: Common MySQL Errors and Solutions [Re: Starfleet14] #258504
02/18/2004 5:19 AM
02/18/2004 5:19 AM
Joined: Feb 2004
Posts: 6
Poland, Lubin
H
HooG Offline
Lurker
HooG  Offline
Lurker
H
Joined: Feb 2004
Posts: 6
Poland, Lubin
Does anyone know what Error 134 mean, or maybe You know where I can get the complete list of errors. Already tried at mysql home page, but its hard to find something there

Re: Common MySQL Errors and Solutions [Re: Nick H] #258505
04/26/2004 7:48 PM
04/26/2004 7:48 PM
Joined: Apr 2003
Posts: 32
USA
J
Jelly_Donut Offline
User
Jelly_Donut  Offline
User
J
Joined: Apr 2003
Posts: 32
USA
Error 134 means that the table record has crashed, or a record you are trying to access has been deleted.

To find out the meaning of any MySQL error, first you need to download MySQL on your computer. Then lauch a command prompt (cmd.exe on WinXP). Then type
Code
C:\mysql\bin\perror.exe -errorno
(Obviously for Windows only, similar on *Nix). You can use a comma-separated list of error numbers if you wish

(Sorry for bumping this, even though it is sticky...)


Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with, and recommend, the following Web Hosts:
· Stable Host
· Blue Host
· Interserver.net
Visit Us on Facebook
Member Spotlight
isaac
isaac
California
Posts: 1,170
Joined: July 2001
Show All Member Profiles 
Forum Statistics
Forums64
Topics37,448
Posts293,484
Members13,793
Most Online1,498
Mar 17th, 2017
Top Posters(All Time)
AllenAyres 25,587
JoshPet 11,330
Rick 8,373
LK 7,396
Lord Dexter 6,503
Gizmo 5,938
Greg Hard 5,533
Top Posters(30 Days)
isaac 4
Today's Statistics
Currently Online 710
Topics Created 0
Posts Made 0
Users Online 1
Birthdays 20
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2018 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 7.6.2
(Preview build 20180611.dev)
Page Time: 0.056s Queries: 15 (0.017s) Memory: 3.3514 MB (Peak: 3.5850 MB) Zlib enabled. Server Time: 2018-06-21 10:03:44 UTC