Perl-Evozon / PearlBee

116 stars 44 forks source link

DB install fails #60

Open petamem opened 8 years ago

petamem commented 8 years ago

After some serious hassle of installing GD (for Auth::Captcha).

No luck with DB init:

www PearlBee # /etc/init.d/mysql start
 * Checking mysqld configuration for mysql ...     [ ok ]
 * Starting mysql ...                              [ ok ]

www PearlBee # mysql -u root -p < db_patches/create_tables.sql
Enter password: 
ERROR 1136 (21S01) at line 121: Column count doesn't match value count at row 1

ok, let's try the other magic line:

www PearlBee # mysql -u root -p < db_patches/set_up_new_db.sql
Enter password: 
ERROR 1046 (3D000) at line 22: No database selected

No PearlBee here running yet...

nlannuzel commented 8 years ago

open db_patches/create_tables.sql remove ",0" at the end of the last line: INSERT INTO settings VALUES ('Europe/Bucharest',1,'','/','PearlBee',1);

This worked for me

flingtoad commented 8 years ago

The problem seems to be that the settings table is created with 6 columns:

CREATE TABLE IF NOT EXISTS `settings` (
  `timezone` varchar(255) NOT NULL,
  `social_media` tinyint(1) NOT NULL DEFAULT '1',
  `theme_folder` varchar(255) NOT NULL,
  `blog_name` varchar(255) NOT NULL,
  `multiuser` tinyint(1) NOT NULL DEFAULT '0',
  `id` int(2) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Settings table.';

The INSERT statement then tries to pass 7 values.

Removing the last value from the INSERT appears to work because you are now passing the right number of values. However, removing the trailing 0 value screws up the alignment of VALUE to COLUMN. Presumably, 'PearlBee' belongs in the 'blog_name' column. I think the incorrect item in the list of values is probably the third value ('') or the fourth value ('/'), depending on what we want to set as out 'theme_folder'. My guess is that '/' is the correct value for 'theme_folder'.

huache commented 8 years ago

In commit ac6032adf44ff9ef68eacb4d76d9ea47220bb4f1 blog_path field in settings table was removed, but the committer forgot to change the last insert statement in db_patches/create_tables.sql.

petamem commented 8 years ago

Revisiting PearlBee...

# mysql -u root -p < db_patches/create_tables_mySQL.sql 
Enter password: 
ERROR 1064 (42000) at line 8: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'TYPE role_type as enum('author','admin')' at line 1

oh come on...

http://stackoverflow.com/questions/1462497/creating-enum-variable-type-in-mysql "No. MySQL does not support CREATE DOMAIN or CREATE TYPE as, for example, PostgreSQL does."

I also see no "ENUM" in the syntax definition of https://mariadb.com/kb/en/sql-99/create-type-statement/

huache commented 8 years ago

@petamem Sorry, I am not very sure what exactly you wan to express. It seems that someone changed the file db_patches/create_tables.sql to db_patches/create_tables_mySQL.sql, and change the sql statement. So, you are actually in front of a totally different problem now. Of course, the solution other people posted in this issue will be not worked. You need to find another solution. However, if you just want to try PearlBee, checkout the commit ac6032a and modify the file like I said, It will be worked. I have tried it by myself. Good luck !