Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: Maxie2019 on July 06, 2022, 09:28:38 PM

Title: Data Base Error
Post by: Maxie2019 on July 06, 2022, 09:28:38 PM
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."


Title: Re: Data Base Error
Post by: Sir Osis of Liver on July 06, 2022, 09:53:28 PM
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.
Title: Re: Data Base Error
Post by: Oldiesmann on July 06, 2022, 10:02:22 PM
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;
Title: Re: Data Base Error
Post by: Sir Osis of Liver on July 06, 2022, 10:07:11 PM
If the database is damaged, might be better to restore a recent backup, there might be other problems.
Title: Re: Data Base Error
Post by: 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.
Title: Re: Data Base Error
Post by: Maxie2019 on July 06, 2022, 10:58:09 PM
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.
Title: Re: Data Base Error
Post by: Oldiesmann on July 06, 2022, 11:00:25 PM
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
Title: Re: Data Base Error
Post by: Doug Heffernan on July 07, 2022, 05:03:22 AM
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.
Title: Re: Data Base Error
Post by: Oldiesmann on July 07, 2022, 12:05:52 PM
The data file wouldn't be called "smf_log_errors.MYD" if the prefix were something different ;)
Title: Re: Data Base Error
Post by: Doug Heffernan on July 07, 2022, 12:50:40 PM
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.  :(
Title: Re: Data Base Error
Post by: Maxie2019 on July 07, 2022, 07:48:02 PM
Thanks guys! I'll be back  ;D
Title: Re: Data Base Error
Post by: Maxie2019 on July 10, 2022, 09:02:24 PM
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.
Title: Re: Data Base Error
Post by: Oldiesmann on July 11, 2022, 12:10:13 AM
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.
Title: Re: Data Base Error
Post by: Maxie2019 on July 12, 2022, 05:55:19 PM
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?
Title: Re: Data Base Error
Post by: Oldiesmann on July 12, 2022, 06:00:29 PM
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.
Title: Re: Data Base Error
Post by: Maxie2019 on July 12, 2022, 06:11:47 PM
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?
Title: Re: Data Base Error
Post by: Oldiesmann on July 12, 2022, 07:12:50 PM
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.
Title: Re: Data Base Error
Post by: Sir Osis of Liver on July 12, 2022, 07:18:09 PM
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.
Title: Re: Data Base Error
Post by: Maxie2019 on July 12, 2022, 07:28:49 PM
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'?

Title: Re: Data Base Error
Post by: Sir Osis of Liver on July 12, 2022, 07:37:55 PM
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.
Title: Re: Data Base Error
Post by: Maxie2019 on July 12, 2022, 08:00:40 PM
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!  :)
Title: Re: Data Base Error
Post by: Maxie2019 on July 13, 2022, 02:31:38 PM
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'
Title: Re: Data Base Error
Post by: Maxie2019 on July 13, 2022, 03:22:37 PM
Should the script just be coped from 'Create Table'?
Title: Re: Data Base Error
Post by: 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.
Title: Re: Data Base Error
Post by: Maxie2019 on July 13, 2022, 04:13:33 PM
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'?
Title: Re: Data Base Error
Post by: Doug Heffernan on July 13, 2022, 04:21:42 PM
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.
Title: Re: Data Base Error
Post by: Oldiesmann on July 13, 2022, 04:36:02 PM
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.
Title: Re: Data Base Error
Post by: Maxie2019 on July 13, 2022, 04:50:28 PM
All sorted guys, thanks so much for your help!! Consider yourselves all bought a virtual drink   :)