FAQ: DB function failed with error number 1016
Posted: Tue Nov 01, 2005 8:18 am
Q. How do I fix a "DB function failed with error number 1016" error?
Example of error:
DB function failed with error number 1016
Can't open file: 'mos_session.MYI'. (errno: 145) SQL=SELECT session_id FROM mos_session WHERE session_id=MD5('c82c53720d94a9ec7256143da29892b5')
SQL = SELECT session_id FROM mos_session WHERE session_id=MD5('c82c53720d94a9ec7256143da29
Joomla default now names this table jos_session.
A. This error is usually due to the session table being damaged. Repair the table.
Repair the table using a free MySQL tool such as phpMyAdmin or MySQL Administrator.
phpMyAdmin
- Login to your phpMyAdmin DB tool
- Select your Joomla DB
- Find the session table (mos_sessions or jos_sessions, or use your DB prefix)
- Check the check box next to the session table
- Select the Repair option from the drop down select list
MySQL Administrator
- Select Catalogs
- Select your Joomla database
- Select the jos_sessions table
- Select Maintenance button (Tables Maintenance)
- Check box Repair Tables
- Click Next
- Click Repair Tables
If repairing the table does not work, you may delete (drop) and recreate the table.
The table does not contain any permanent data so nothing will be lost.
This SQL code will drop the sessions table and recreate it.
Code: Select all
DROP TABLE `jos_session`;
CREATE TABLE `jos_session` (
`username` varchar(50) default '',
`time` varchar(14) default '',
`session_id` varchar(200) NOT NULL default '0',
`guest` tinyint(4) default '1',
`userid` int(11) default '0',
`usertype` varchar(50) default '',
`gid` tinyint(3) unsigned NOT NULL default '0',
PRIMARY KEY (`session_id`),
KEY `whosonline` (`guest`,`usertype`)
) TYPE=MyISAM;
Enter this SQL code into MySQL directly, or by using a MySQL tool such as phpMyAdmin or MySQL Query Browser.
If you are still using tables with the old "mos_" prefix, change "jos_" to "mos_" in the above SQL code.