Mods can't create tables in MYSQL database

Started by Jelle Mees, April 26, 2008, 08:07:38 PM

Previous topic - Next topic

Jelle Mees

Every mod that requires a table in the database doesn't work simply because the mods can't create the tables in the database for some reason.

For example, if I install the bookmarks mod I get this:
QuoteTable 'Trackmania.smf1_bookmarks' doesn't exist
File: /mounted-storage/home30c/sub002/sc26341-IINL/www/FlemishArmySite/Trackmania/Sources/Bookmarks.php
Line: 115

Oldiesmann

Are there any errors in your forum error log related to table creation?
Michael Eshom
Christian Metal Fans

Jelle Mees

#2
I have 5 database errors and they are all "doesn't exist" errors. No creation or connection errors.

The forum installation went fine, and every mod I install works fine, as long as it doesn't require a new table.

I get these "doesn't exist" errors on every page that requires the table.

I am using default theme and default language so It can't be any more compatible then that.

SwapsRulez

Quote from: Jelle Mees on April 27, 2008, 03:41:05 AM
I have 5 database errors and they are all "doesn't exist" errors. No creation or connection errors.

The forum installation went fine, and every mod I install works fine, as long as it doesn't require a new table.

I get these "doesn't exist" errors on every page that requires the table.

I am using default theme and default language so It can't be any more compatible then that.

I think try installing the MODS in the manual way & check out for the changes in the file. After completing the files editing part. Just go to phpmyadmin, there in your database. run the query given in the instructions of the MOD. You'll find it working in that way ;)
Project-BB.org : Educational Forum For Engineering, Diploma & Technical Students

The Engineering, Diploma & All technical students lounge for Free Projects, Seminars, Syllabus, Question Papers, College Assignments, Placement Papers, E-Books, Company Information & other technical stuffs.

H

Does the SMF MySQL user have permissions to create new tables? You can check in cpanel or whichever control panel you have
-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)
                             

Jelle Mees

@SwapsRules:
There is no query givin, almost nobody does that. What I do have is this:

<?php
global $smcFunc;

$smcFunc['db_create_table']('bookmarks',
array(
array(
'name' => 'id_member',
'type' => 'mediumint',
'size' => 8,
),
array(
'name' => 'id_topic',
'type' => 'mediumint',
'size' => 8,
),
),
array(
'name' => 'bookmark',
'type' => 'unique',
'columns' => array('id_member''id_topic'),
),
array(),
'ignore');
?>


My SQL knowledge is to low for me to rewrite as a SQL command.

@H:
Eeuhm, I don't know what you are talking about. I created mysql table and installed SMF, what are these permissions you talk about???

H

The bookmarks mod didn't fully install which is why you're getting these errors. Most likely the SMF user may not have permissions to create tables?
-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)
                             

Jelle Mees

Quote from: H on April 28, 2008, 01:02:40 PM
The bookmarks mod didn't fully install which is why you're getting these errors. Most likely the SMF user may not have permissions to create tables?

I am the SMF user, the admin. There is only one account on my SMF forum and that's the admin account.

Dragooon

H meant MySQL User admin, not SMF permissions, MySQL users got there separate permissions for various things like creating, altering tables etc etc.

They should be in host control panel.

Jelle Mees

#9
Quote from: Dragooon on April 28, 2008, 01:18:54 PM
H meant MySQL User admin, not SMF permissions, MySQL users got there separate permissions for various things like creating, altering tables etc etc.

They should be in host control panel.

Again, don't really understand what you are talking about. I am admin and have FULL rights to everything. SMF, MYSQL, PHP settings, etc...
I can go to phpmyamin and create tables.

And I don't understand why you ask this.

Installing SMF = creating tables in MYSQL database, without that permission you can't eaven install SMF, or am I mistaking...

---------------------------------------------------

Maybe this is the problem.

Look at the code:

<?php
global $smcFunc;

$smcFunc['db_create_table']('bookmarks',


I see "Global", does that mean that I need to enable global variables in order for the installation to succeed?

H

global variables cannot be disabled (if they could then none of SMF would be working!).

Which bookmark mod are you using? You did install through the Package Manager?
-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)
                             

Jelle Mees

Quote from: H on April 29, 2008, 03:31:50 PM
global variables cannot be disabled (if they could then none of SMF would be working!).

Which bookmark mod are you using? You did install through the Package Manager?

It doesn't mather wich mod it is, every single mod that requires new MYSQL tables does not work, simply because the tables are not getting created.

And yes, I use the package manager for all my mods.

PS: Thanks for not giving up on me :)

rsw686

Check the mysql user permissions. Are you sure they didn't get changed after you installed SMF. Thats the only thing I can think of.
The Reptile File
Everything reptile for anyone reptile friendly

Aquaria Talk
Community for freshwater and saltwater aquariums enthusiasts

Jelle Mees

Quote from: rsw686 on April 29, 2008, 08:57:16 PM
Check the mysql user permissions. Are you sure they didn't get changed after you installed SMF. Thats the only thing I can think of.

I am admin, 100000000% sure.

Have you guys installed mods that require new MYSQL tables? I don't mind that you assume that I am doing something rong, but have you guys actually tried it yourself?

rsw686

Quote from: Jelle Mees on April 30, 2008, 11:36:24 AM
Have you guys installed mods that require new MYSQL tables? I don't mind that you assume that I am doing something rong, but have you guys actually tried it yourself?

I have, I just use a create table sql statement with the query function. If I have some time later I'll test out the create table function.
The Reptile File
Everything reptile for anyone reptile friendly

Aquaria Talk
Community for freshwater and saltwater aquariums enthusiasts

Jelle Mees

Just know that I don't have this problem with phpbb.

karlbenson

Its unlikely that using create table will work for postgresql or sqlite.
At the moment very few mods that work for 2.x have needed to create a table.

This probably isn't stylised as much as I'd like. But I'm successfully using
Quote// Columns for our table
$table_columns = array(
   array('name' => 'id_member', 'type' => 'mediumint', 'size' => 8, 'null' => false, 'default' => 0),
   array('name' => 'id_topic', 'type' => 'mediumint', 'size' => 8, 'null' => false, 'default' => 0),
   array('name' => 'date_ignored', 'type' => 'int', 'size' => 10, 'null' => false, 'default' => 0)
);

// Indexes for our table
$table_indexes = array(
   array('name' => 'topic', 'columns' => array('id_member', 'id_topic'), 'type' => 'unique')
);

// Create the table
$smcFunc['db_create_table']('ignore_topics', $table_columns, $table_indexes);
On one of my unreleased mods.

Jelle Mees

Can I trust someone with admin acces on my forum? Maybe if I give one of you guys admin acces on my forum + MYSQL connection data, you might be able to see what's happening.

H

A reminder about admin / ftp passwords...

Generally anyone with a staff 'badge' or someone with the "<Insert team> Team Apprentice". Karl seems to have a few ideas up his sleeve :)
-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)
                             

rsw686

Okay this is slightly strange. I put together a short script using Karl's code and including the SSI file. The db_create_table is not a valid index in the array. I did a var_dump of smcFunc and it is not there. The other functions like db_query work as expected. Has anybody gotten this to work with SSI. I guess I could stick this in an SMF page somewhere to test. I just know that some people prefer to run the scripts separate from the package manager.

<?php
// If SSI.php is in the same place as this file, and SMF isn't defined, this is being run standalone.
if (file_exists(dirname(__FILE__) . '/SSI.php') && !defined('SMF'))
include_once(dirname(__FILE__) . '/SSI.php');
// Hmm... no SSI.php and no SMF?
elseif (!defined('SMF'))
die('<b>Error:</b> Cannot install - please verify you put this in the same place as SMF\'s index.php.');

// This works fine
$request $smcFunc['db_query']('''
SELECT ID_PROFILE FROM {db_prefix}profile'
);
$rows $smcFunc['db_num_rows']($request);
$smcFunc['db_free_result']($request);

// Columns for our table
$table_columns = array(
   array(
'name' => 'id_member''type' => 'mediumint''size' => 8'null' => false'default' => 0),
   array(
'name' => 'id_topic''type' => 'mediumint''size' => 8'null' => false'default' => 0),
   array(
'name' => 'date_ignored''type' => 'int''size' => 10'null' => false'default' => 0)
);

// Indexes for our table
$table_indexes = array(
   array(
'name' => 'topic''columns' => array('id_member''id_topic'), 'type' => 'unique')
);

// Look at the var dump
var_dump($smcFunc);

// This doesn't work
// Create the table
$smcFunc['db_create_table']('ignore_topics'$table_columns$table_indexes);
?>

The Reptile File
Everything reptile for anyone reptile friendly

Aquaria Talk
Community for freshwater and saltwater aquariums enthusiasts

Advertisement: