BookStack icon indicating copy to clipboard operation
BookStack copied to clipboard

Bookstack install - Syntax error when updating database

Open JaeggerLegane opened this issue 1 year ago • 9 comments

Describe the Bug

I'm trying to install bookstack on a webbased host with the "Manual Installation" steps, outlined on the bookstack website: https://www.bookstackapp.com/docs/admin/installation/

I've performed the first 7 steps but however get an error when trying to update the database with the "php artisan migrate" command.

I get the following error: Capture

Could somebody help on how to resolve this?

Steps to Reproduce

  1. Open a terminal
  2. Cd to my installation directory
  3. Run the command "php artisan migrate"

Expected Behaviour

It should complete the php artisan migration.

Screenshots or Additional Context

Capture

Browser Details

Chrome

Exact BookStack Version

24.05.01

JaeggerLegane avatar May 30 '24 13:05 JaeggerLegane

Hi @JaeggerLegane, Can you detail the environment you're installing BookStack into (Operating System, database software & version/location etc...)

ssddanbrown avatar May 30 '24 14:05 ssddanbrown

Hi @JaeggerLegane, Can you detail the environment you're installing BookStack into (Operating System, database software & version/location etc...)

Hello Dan,

Thanks for your reply.

Here are some details of my environment:

  • Shared host
  • Apache 2.4.59
  • MariaDB 10.5.25
  • OS = Linux
  • Web server = php 8.1.28

The error seems to point to script "2020_08_04_111754_drop_joint_permissions_id". Do I need to update this script? If so, could you tell me what I would need to change?

Thanks in advance for your help

JaeggerLegane avatar May 30 '24 18:05 JaeggerLegane

Hi @JaeggerLegane, You should not need to edit any app files, including that script.

The error shared would only really appear on subsequent php artisan migrate runs, after the first. The real underlying issue would likely only have been seen on the original php artisan migrate run. Ideally we need to see the error message thrown on the first command run.

If possible, and if there's no existing data to save in this instance, Could you delete all existing tables in the bookstack database then re-run the php artisan migrate step, being sure to record any errors that appear on first run. Be careful if you share this database with any other applications, to ensure you only delete the tables for BookStack (always a good idea to backup the whole database if there's any risk of data).

ssddanbrown avatar May 30 '24 22:05 ssddanbrown

Hi @JaeggerLegane, You should not need to edit any app files, including that script.

The error shared would only really appear on subsequent php artisan migrate runs, after the first. The real underlying issue would likely only have been seen on the original php artisan migrate run. Ideally we need to see the error message thrown on the first command run.

If possible, and if there's no existing data to save in this instance, Could you delete all existing tables in the bookstack database then re-run the php artisan migrate step, being sure to record any errors that appear on first run. Be careful if you share this database with any other applications, to ensure you only delete the tables for BookStack (always a good idea to backup the whole database if there's any risk of data).

Hello Dan,

Thanks for your response. I've deleted all the underlying tables in the DB and reran the php artisan migrate command.

I'm getting an error again relating to the permissions id script but it's slightly different this time, see below: image

Any ideas?

JaeggerLegane avatar May 31 '24 13:05 JaeggerLegane

Thanks for the information @JaeggerLegane. I've seen this occur before when an older (now-non-default) database engine is used. Does your shared hosting provider give any control/option/access for the default database engine in use? Or do you have access to change default database configuration options at all?

ssddanbrown avatar May 31 '24 13:05 ssddanbrown

Thanks for the information @JaeggerLegane. I've seen this occur before when an older (now-non-default) database engine is used. Does your shared hosting provider give any control/option/access for the default database engine in use? Or do you have access to change default database configuration options at all?

I have considerable access to make changes to the DB engine myself yes. But for anything else I may need the webhost team, they are however pretty flexible on my requests.

What would you recommend that I change?

JaeggerLegane avatar May 31 '24 13:05 JaeggerLegane

@JaeggerLegane Do you have the ability to set the default_storage_engineoption? (Commonly done on non-shared systems via amy.conf` file)

If so, set that to default_storage_engine=InnoDB (which is usually the default). Then restart the database, then re-attempt from an empty database.

ssddanbrown avatar Jun 02 '24 15:06 ssddanbrown

I encountered this error and resolved it by setting the mysql engine to 'InnoDB' here: https://github.com/BookStackApp/BookStack/blob/47ac0d5c3eadcb1d2260dac1d736b0517b6498a0/app/Config/database.php#L78

CdrMarks avatar Jul 15 '24 23:07 CdrMarks

Also having the same issue on shared hosting. I can move to AWS EC2 and either self manage DB or use RDS, but wanting to demo it so using shared hosting which I have on hand.

Our shared hosting is using MariaDB 10.6. We access it via phpMyAdmin in cPanel. Going into the DB settings I can see a the setting of default_storage_engine, and it is set to MyISAM 🤢

Trying to update it with,

SET GLOBAL default_storage_engine = 'InnoDB'

I get,

#1227 - Access denied; you need (at least one of) the SUPER privilege(s) for this operation

I was able to delete all tables and edit the file like @CdrMarks said,

      'engine'         => 'InnoDB',

this installed it all fine.

Would it make any sense to expose this to the .env file?

'engine'    => env('DB_ENGINE', null),

beeradmoore avatar Oct 02 '24 07:10 beeradmoore