News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Data Base Error

Started by Maxie2019, July 06, 2022, 09:28:38 PM

Previous topic - Next topic

Maxie2019

Hi,

We're receiving the following error, which obviously means we need to update the forum. It's been a while since I have been on the forum and I was clearly the last person to update it. Can someone please talk me through the process? Forum version is currently SMF 2.0.15 (as per error).

Cheers in advance :)


"Database Error
File './jeremyba_smf/smf_log_errors.MYD' not found (Errcode: 2 "No such file or directory")
File: /home/jeremyba/public_html/Sources/ManageBans.php
Line: 988
"It appears that your database may require an upgrade. Your forum's files are currently at version SMF 2.0.15, while your database is at version 2.0.4. The above error might possibly go away if you execute the latest version of upgrade.php."



Sir Osis of Liver

The error has nothing to do with forum or database version.  smf_log_errors is not a file or directory, it's a database table.  You can upgrade from 2.0.15 > .16 > .17 > .18 > .19 in package manager, look for a message up top that there's an update available.  There are no database changes in 2.0 branch, so database will remain the same.  If you continue to log that error, it's most likely due to a mod.  Your host may have upgraded php version and you may have an outdated mod that doesn't support current version.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Oldiesmann

That means the data file for the log_errors table is missing. The easiest way to fix the problem is to just drop the table and recreate it. Run this in phpMyAdmin:

DROP TABLE smf_log_errors;
CREATE TABLE smf_log_errors (
  id_error mediumint(8) unsigned NOT NULL auto_increment,
  log_time int(10) unsigned NOT NULL default '0',
  id_member mediumint(8) unsigned NOT NULL default '0',
  ip char(16) NOT NULL default '                ',
  url text NOT NULL,
  message text NOT NULL,
  session char(32) NOT NULL default '                                ',
  error_type char(15) NOT NULL default 'general',
  file varchar(255) NOT NULL default '',
  line mediumint(8) unsigned NOT NULL default '0',
  PRIMARY KEY (id_error),
  KEY log_time (log_time),
  KEY id_member (id_member),
  KEY ip (ip(16))
) ENGINE=MyISAM;
Michael Eshom
Christian Metal Fans

Sir Osis of Liver

If the database is damaged, might be better to restore a recent backup, there might be other problems.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Maxie2019

Quote from: Oldiesmann on July 06, 2022, 10:02:22 PMThat means the data file for the log_errors table is missing. The easiest way to fix the problem is to just drop the table and recreate it. Run this in phpMyAdmin:

DROP TABLE smf_log_errors;
CREATE TABLE smf_log_errors (
  id_error mediumint(8) unsigned NOT NULL auto_increment,
  log_time int(10) unsigned NOT NULL default '0',
  id_member mediumint(8) unsigned NOT NULL default '0',
  ip char(16) NOT NULL default '                ',
  url text NOT NULL,
  message text NOT NULL,
  session char(32) NOT NULL default '                                ',
  error_type char(15) NOT NULL default 'general',
  file varchar(255) NOT NULL default '',
  line mediumint(8) unsigned NOT NULL default '0',
  PRIMARY KEY (id_error),
  KEY log_time (log_time),
  KEY id_member (id_member),
  KEY ip (ip(16))
) ENGINE=MyISAM;

Where will I find phpMyAdmin - it's been a few years since I had to do any of this stuff.

Maxie2019

Quote from: Sir Osis of Liver on July 06, 2022, 10:07:11 PMIf the database is damaged, might be better to restore a recent backup, there might be other problems.


I can request a back-up - thanks.

Oldiesmann

Quote from: Maxie2019 on July 06, 2022, 10:56:26 PM
Quote from: Oldiesmann on July 06, 2022, 10:02:22 PMThat means the data file for the log_errors table is missing. The easiest way to fix the problem is to just drop the table and recreate it. Run this in phpMyAdmin:

DROP TABLE smf_log_errors;
CREATE TABLE smf_log_errors (
  id_error mediumint(8) unsigned NOT NULL auto_increment,
  log_time int(10) unsigned NOT NULL default '0',
  id_member mediumint(8) unsigned NOT NULL default '0',
  ip char(16) NOT NULL default '                ',
  url text NOT NULL,
  message text NOT NULL,
  session char(32) NOT NULL default '                                ',
  error_type char(15) NOT NULL default 'general',
  file varchar(255) NOT NULL default '',
  line mediumint(8) unsigned NOT NULL default '0',
  PRIMARY KEY (id_error),
  KEY log_time (log_time),
  KEY id_member (id_member),
  KEY ip (ip(16))
) ENGINE=MyISAM;

Where will I find phpMyAdmin - it's been a few years since I had to do any of this stuff.

Through cPanel or whatever control panel your host uses
Michael Eshom
Christian Metal Fans

Doug Heffernan

Quote from: Maxie2019 on July 06, 2022, 10:56:26 PMWhere will I find phpMyAdmin - it's been a few years since I had to do any of this stuff.

Note that if your dtabase prefix is something other than smf, you must use that instead of the standard smf_ at the sql query above.

Oldiesmann

The data file wouldn't be called "smf_log_errors.MYD" if the prefix were something different ;)
Michael Eshom
Christian Metal Fans

Doug Heffernan

Quote from: Oldiesmann on July 07, 2022, 12:05:52 PMThe data file wouldn't be called "smf_log_errors.MYD" if the prefix were something different ;)

You are right. I missed that in the op.  :(

Maxie2019

Thanks guys! I'll be back  ;D

Maxie2019

#11
That means the data file for the log_errors table is missing. The easiest way to fix the problem is to just drop the table and recreate it. Run this in phpMyAdmin:

DROP TABLE smf_log_errors;
CREATE TABLE smf_log_errors (
  id_error mediumint(8) unsigned NOT NULL auto_increment,
  log_time int(10) unsigned NOT NULL default '0',
  id_member mediumint(8) unsigned NOT NULL default '0',
  ip char(16) NOT NULL default '                ',
  url text NOT NULL,
  message text NOT NULL,
  session char(32) NOT NULL default '                                ',
  error_type char(15) NOT NULL default 'general',
  file varchar(255) NOT NULL default '',
  line mediumint(8) unsigned NOT NULL default '0',
  PRIMARY KEY (id_error),
  KEY log_time (log_time),
  KEY id_member (id_member),
  KEY ip (ip(16))
) ENGINE=MyISAM;

OK, when you say 'run this' what exactly do I do with it? I hate messing with the database, makes me nervous, so would appreciate some instructions when you get time? Thanks in advance.

Oldiesmann

Login to phpMyAdmin, select the appropriate database (if necessary), then click the "SQL" tab. Paste that in the box and click the "Go" button in the bottom right corner.
Michael Eshom
Christian Metal Fans

Maxie2019

I was ready to apply this tonight and contacted the host company to make a back-up of the forum DB, just in case. The response is below but is it likely that any damage could occur if we just went ahead and ran the script?

Host email reply
"Thanks for the details. Im unable to take a backup of the database due to the error "File './jeremyba_smf/smf_log_errors.MYD' not found (Errcode: 2 "No such file or directory")File", Its not possible to take the full SQL backup(dump) of database without fixing the error.

The backup returns with the following error.

mysqldump: Got error: 29: "File './jeremyba_smf/smf_log_errors.MYD' not found (Errcode: 2 "No such file or directory")" when using LOCK TABLES

Please check with SMF team if there is any option to take a backup by temporarily fixing the above error."

Any ideas?

Oldiesmann

No there is no way to backup the database if it's already broken. The log_errors table simply logs forum errors and running the SQL I posted won't break anything - it doesn't touch the members table or any other critical data.
Michael Eshom
Christian Metal Fans

Maxie2019

Quote from: Oldiesmann on July 12, 2022, 06:00:29 PMNo there is no way to backup the database if it's already broken. The log_errors table simply logs forum errors and running the SQL I posted won't break anything - it doesn't touch the members table or any other critical data.

Are the two things related? i.e. The original error and the one received as a result of failed back-up?

Oldiesmann

It's the same error both times - the data file for the log_errors table doesn't exist. It's hard to back up non-existent data.
Michael Eshom
Christian Metal Fans

Sir Osis of Liver

Do you see the log_errors table in phpmyadmin?  If it's present and damaged and preventing backup, you should be able to drop it, then dump the database.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Maxie2019

Quote from: Sir Osis of Liver on July 12, 2022, 07:18:09 PMDo you see the log_errors table in phpmyadmin?  If it's present and damaged and preventing backup, you should be able to drop it, then dump the database.

Yes I see it in the list to the side on the left.

So, to clarify (can you tell I am nervous about doing this? :)) all I have to do, is copy the above script and paste it into the 'run SQL query' in C-panel and click 'go'?


Sir Osis of Liver

Yes, but you should dump the database first if you don't have a recent backup.  Click on the database in left column, you'll see list of tables in right panel, check the checkbox next to log_errors table, scroll to bottom, select drop table from the "With selected" dropmenu.  That should remove damaged table, then you should be able to export the database, or download it with cpanel Backup.  Once you have a good backup, copy the above query into sql tab and "Go", that will execute the query and create a new table.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Maxie2019

Quote from: Sir Osis of Liver on July 12, 2022, 07:37:55 PMYes, but you should dump the database first if you don't have a recent backup.  Click on the database in left column, you'll see list of tables in right panel, check the checkbox next to log_errors table, scroll to bottom, select drop table from the "With selected" dropmenu.  That should remove damaged table, then you should be able to export the database, or download it with cpanel Backup.  Once you have a good backup, copy the above query into sql tab and "Go", that will execute the query and create a new table.


Found all of that and looks pretty straight forward. With fingers crossed, I'll apply it and let you know how I get on.

Thanks guys!  :)

Maxie2019

Followed the instructions and had the data base backed up - I then copied the above script into the SQL field and received the following error.

Error
SQL query:


DROP TABLE smf_log_errors
MySQL said: Documentation

#1051 - Unknown table 'jeremyba_smf.smf_log_errors'

Maxie2019

Should the script just be coped from 'Create Table'?

Doug Heffernan

Quote from: Maxie2019 on July 13, 2022, 02:31:38 PMFollowed the instructions and had the data base backed up - I then copied the above script into the SQL field and received the following error.

Error
SQL query:


DROP TABLE smf_log_errors
MySQL said: Documentation

#1051 - Unknown table 'jeremyba_smf.smf_log_errors'

It looks like that table does not exist in the database. You should recreate it using the code posted in the previous page by @Oldiesmann.

Maxie2019

Quote from: Doug Heffernan on July 13, 2022, 04:09:12 PM
Quote from: Maxie2019 on July 13, 2022, 02:31:38 PMFollowed the instructions and had the data base backed up - I then copied the above script into the SQL field and received the following error.

Error
SQL query:


DROP TABLE smf_log_errors
MySQL said: Documentation

#1051 - Unknown table 'jeremyba_smf.smf_log_errors'

It looks like that table does not exist in the database. You should recreate it using the code posted in the previous page by @Oldiesmann.

I did - however, the copy and paste starts with 'Drop' - shouldn't I just copy and paste from 'Create'?

Doug Heffernan

Quote from: Maxie2019 on July 13, 2022, 04:13:33 PMI did - however, the copy and paste starts with 'Drop' - shouldn't I just copy and paste from 'Create'?

The DROP TABLE command is not needed if said table does not exist. In that case, you should omit it from the query. i.e. copy/paste the code from Create command line and run it.

Oldiesmann

Quote from: Sir Osis of Liver on July 12, 2022, 07:37:55 PMYes, but you should dump the database first if you don't have a recent backup.  Click on the database in left column, you'll see list of tables in right panel, check the checkbox next to log_errors table, scroll to bottom, select drop table from the "With selected" dropmenu.  That should remove damaged table, then you should be able to export the database, or download it with cpanel Backup.  Once you have a good backup, copy the above query into sql tab and "Go", that will execute the query and create a new table.


As pointed out above, backing up the database will not work if the data file for the log_errors table is missing. However, the code I posted above shouldn't break the database in any way as it just modifies a single table, so it should be perfectly safe.
Michael Eshom
Christian Metal Fans

Maxie2019

All sorted guys, thanks so much for your help!! Consider yourselves all bought a virtual drink   :)

Advertisement: