Page 1 of 1

mysql create table syntax needs a change

Posted: Thu Nov 11, 2010 12:36 pm
by DiH
Hello,

I'm try to install CMSMS 1.8.2 on server with php5.2 and everything that's needed to work is fulfilled. I'm stuck on step 5 because the script cannot create tables in my database. I tried a lot of stuff and I found a solution. In order to create a table on my host I have to use this syntax:

CREATE TABLE user.table_name ...

while CMSMS create it the normal way:

CREATE TABLE able_name ...

Could you tell me which files to change and where to put that addition to make the CMS work? I could add the user manually to stay hard-coded as I will always user the same username. Or, is there any other solution?

Thanks in advance,
DiH

Re: mysql create table syntax needs a change

Posted: Thu Nov 11, 2010 1:44 pm
by Peciura
Proper way is to edit "/config.php" like this
$config['db_prefix'] = 'user.cms_';

Re: mysql create table syntax needs a change

Posted: Thu Nov 11, 2010 1:51 pm
by DiH
Thank you for your response. But isn't config.php file empty before installation is complete?

Re: mysql create table syntax needs a change

Posted: Thu Nov 11, 2010 2:00 pm
by DiH
I modified \install\lib\classes\CMSInstaller.class.php

line 237: $result = $db->Execute('CREATE TABLE user.' . $db_prefix . 'dummyinstall (i int)');
and
line 240: $result = $db->Execute('DROP TABLE user.' . $db_prefix . 'dummyinstall');

but it didn't work either.

Re: mysql create table syntax needs a change

Posted: Thu Nov 11, 2010 2:19 pm
by Peciura
There is a field "Table prefix" on 5th installation step. Change value to "user.cms_" and hopefully everything will be ok.

Re: mysql create table syntax needs a change

Posted: Fri Nov 12, 2010 12:28 pm
by DiH
I did that, but the script did not let me use dot (.), so I changed the regex in CMSInstaller.class.php, on line 204 to:

Code: Select all

&& !preg_match('/^[a-zA-Z0-9._]+$/', trim($_POST['prefix'])) )
I moved to created tables, but they all fail create...

Creating additional_users table... [failed]
...
Importing sample data...Invalid query: INSERT INTO user.cms_version VALUES (33);

I see no hope.

Re: mysql create table syntax needs a change

Posted: Fri Nov 12, 2010 3:59 pm
by Peciura
test it

Code: Select all

&& !preg_match('/^[a-zA-Z0-9\._]+$/', trim($_POST['prefix'])) )