mirror of
https://github.com/BookStackApp/BookStack.git
synced 2026-02-11 03:13:15 +03:00
SQLSTATE Connection Refused #3731
Closed
opened 2026-02-05 07:16:48 +03:00 by OVERLORD
·
14 comments
No Branch/Tag Specified
development
l10n_development
release
llm_only
vectors
v25-11
docker_env
drawio_rendering
user_permissions
ldap_host_failover
svg_image
prosemirror
captcha_example
fix/video-export
v25.12.3
v25.12.2
v25.12.1
v25.12
v25.11.6
v25.11.5
v25.11.4
v24.11.4
v25.11.3
v25.11.2
v25.11.1
v25.11
v25.07.3
v25.07.2
v25.07.1
v25.07
v25.05.2
v25.05.1
v25.05
v25.02.5
v25.02.4
v25.02.3
v25.02.2
v25.02.1
v25.02
v24.12.1
v24.12
v24.10.3
v24.10.2
v24.10.1
v24.10
v24.05.4
v24.05.3
v24.05.2
v24.05.1
v24.05
v24.02.3
v24.02.2
v24.02.1
v24.02
v23.12.3
v23.12.2
v23.12.1
v23.12
v23.10.4
v23.10.3
v23.10.2
v23.10.1
v23.10
v23.08.3
v23.08.2
v23.08.1
v23.08
v23.06.2
v23.06.1
v23.06
v23.05.2
v23.05.1
v23.05
v23.02.3
v23.02.2
v23.02.1
v23.02
v23.01.1
v23.01
v22.11.1
v22.11
v22.10.2
v22.10.1
v22.10
v22.09.1
v22.09
v22.07.3
v22.07.2
v22.07.1
v22.07
v22.06.2
v22.06.1
v22.06
v22.04.2
v22.04.1
v22.04
v22.03.1
v22.03
v22.02.3
v22.02.2
v22.02.1
v22.02
v21.12.5
v21.12.4
v21.12.3
v21.12.2
v21.12.1
v21.12
v21.11.3
v21.11.2
v21.11.1
v21.11
v21.10.3
v21.10.2
v21.10.1
v21.10
v21.08.6
v21.08.5
v21.08.4
v21.08.3
v21.08.2
v21.08.1
v21.08
v21.05.4
v21.05.3
v21.05.2
v21.05.1
v21.05
v21.04.6
v21.04.5
v21.04.4
v21.04.3
v21.04.2
v21.04.1
v21.04
v0.31.8
v0.31.7
v0.31.6
v0.31.5
v0.31.4
v0.31.3
v0.31.2
v0.31.1
v0.31.0
v0.30.7
v0.30.6
v0.30.5
v0.30.4
v0.30.3
v0.30.2
v0.30.1
v0.30.0
v0.29.3
v0.29.2
v0.29.1
v0.29.0
v0.28.3
v0.28.2
v0.28.1
v0.28.0
v0.27.5
v0.27.4
v0.27.3
v0.27.2
v0.27.1
v0.27
v0.26.4
v0.26.3
v0.26.2
v0.26.1
v0.26.0
v0.25.5
v0.25.4
v0.25.3
v0.25.2
v0.25.1
v0.25.0
v0.24.3
v0.24.2
v0.24.1
v0.24.0
v0.23.2
v0.23.1
v0.23.0
v0.22.0
v0.21.0
v0.20.3
v0.20.2
v0.20.1
v0.20.0
v0.19.0
v0.18.5
v0.18.4
v0.18.3
v0.18.2
v0.18.1
v0.18.0
v0.17.4
v0.17.3
v0.17.2
v0.17.1
v0.17.0
v0.16.3
v0.16.2
v0.16.1
v0.16.0
v0.15.3
v0.15.2
v0.15.1
v0.15.0
v0.14.3
v0.14.2
v0.14.1
v0.14.0
v0.13.1
v0.13.0
v0.12.2
v0.12.1
v0.12.0
v0.11.2
v0.11.1
v0.11.0
v0.10.0
v0.9.3
v0.9.2
v0.9.1
v0.9.0
v0.8.2
v0.8.1
v0.8.0
v0.7.6
v0.7.5
v0.7.4
v0.7.3
0.7.2
v.0.7.1
v0.7.0
v0.6.3
v0.6.2
v0.6.1
v0.6.0
v0.5.0
Labels
Clear labels
🎨 Design
📖 Docs Update
🐛 Bug
🐛 Bug
:cat2:🐈 Possible duplicate
💿 Database
☕ Open to discussion
💻 Front-End
🐕 Support
🚪 Authentication
🌍 Translations
🔌 API Task
🏭 Back-End
⛲ Upstream
🔨 Feature Request
🛠️ Enhancement
🛠️ Enhancement
🛠️ Enhancement
❤️ Happy feedback
🔒 Security
🔍 Pending Validation
💆 UX
📝 WYSIWYG Editor
🌔 Out of scope
🔩 API Request
:octocat: Admin/Meta
🖌️ View Customization
❓ Question
🚀 Priority
🛡️ Blocked
🚚 Export System
♿ A11y
🔧 Maintenance
> Markdown Editor
pull-request
Mirrored from GitHub Pull Request
No Label
🐕 Support
Milestone
No items
No Milestone
Projects
Clear projects
No project
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: starred/BookStack#3731
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @samundo on GitHub (Apr 4, 2023).
Attempted Debugging
Searched GitHub Issues
Describe the Scenario
I tried to load Bookstack web interface via IP and I got a site not reachable. I use watchtower to update Bookstack. I noticed on the container log files it said new config files. I loaded the new config files and those errors disappeared. Now when I load the web interface via IP I get a white page. In the container log I now get this error saying Connect Refused as you can see from error in container logs below. Any suggestions on what/how to fix this?
Exact BookStack Version
Not Sure cannot load interface
Log Content
Details
PHP Version
??
Hosting Environment
Ubuntu 20.04.2, VPS.
Installed by docker compose script
@ssddanbrown commented on GitHub (Apr 4, 2023):
Hi @samundo,
Generally an error of
SQLSTATE[HY000] [2002] Connection refusedmeans the app simply can't connect to the database at all. Might just not have network visibility.Could be due to wrong
DB_*options used in BookStack. Could be networking issue.If you could provide a copy of your docker-compose file (With any secrets redacted) that would be helpful.
What do you exactly mean by this? What exact steps/files did you touch?
@samundo commented on GitHub (Apr 4, 2023):
Hi @ssddanbrown, Thanks for the quick reply.
Docker-compose file below. I have customised it and was working for the paste year and stopped working in the last month. Not sure when as I have been overseas. I just got back and went to access my wiki and would not load.
I have checked the containers and they are on the same network. 172.18.0.xx
I have checked the .env file and made sure details matched.
With this message
I loaded the new config files
In the container console it came up with a message that the following files are old and there is new files. Not sure how to replicate the error as it has now gone since I loaded the new files.
Files that were old were
default.conf
nginx.conf
ssl.conf
I went in and renamed these files as old.xxx.conf moved the files to an archives folder. In the folder there was a new sample file. I copied that and then rename it to the above. Regenerated the container and the error disappeared. Then I was left with the SQL error only. If you need I could put the archive files back to generate the error. When the old files are there the web interface does not load. Once I changed the files to the new files the web interface loads but with white screen. Not sure if this is relevant.
@ssddanbrown commented on GitHub (Apr 6, 2023):
@samundo Ah, okay, those files changes are part of linuxserver changes. Should not affect the reported error at play so don't think we need to consider them as a cause at all.
You've probably already done this, but can you confirm that the database container is starting up and running without error? Should be able to watch the logs for the database container to ensure it's not actually in a constantly restarting/error state.
If that's okay could you access the running BookStack container, and test connection via
ping bookstack_db? Just to ensure that returns on ping as expected.If that works, you could try to connect to the database using the
mysqlcommand line from the BookStack container:@samundo commented on GitHub (Apr 7, 2023):
@ssddanbrown I am using portainer and connected to the BookStack container and was able to ping the bookstack_db. It replied with
64 bytes from 172.18.0.3: seq=0 ttl=64 time=0.143 ms
I then tried the next section to enter mysql but in the BookStack container it says
bash: mysql: command not found
I have then gone into the bookstack_db container and tried connecting to mysql and I get this error
ERROR 2002 (HY000): Can't connect to local server through socket '/run/mysqld/mysqld.sock' (2)
If there is something I am doing wrong please advise.
@samundo commented on GitHub (Apr 7, 2023):
@ssddanbrown forgot to add the logs from the bookstack_db
Caught SIGTERM signal!
cat: /var/run/mysqld/mysqld.pid: No such file or directory
230407 20:44:43 mysqld_safe Logging to '/config/databases/a28276778c36.err'.
230407 20:44:43 mysqld_safe Starting mariadbd daemon with databases from /config/databases
This message is appearing every 3 seconds.
@ssddanbrown commented on GitHub (Apr 7, 2023):
@samundo Can you check that
databases/a28276778c36.errfile within the mounted folder for the database container to get more information?@samundo commented on GitHub (Apr 9, 2023):
@ssddanbrown the file is 515mb, so I have copied the last logs from the file.
230404 21:53:03 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
230404 21:53:04 mysqld_safe Starting mariadbd daemon with databases from /config/databases
2023-04-04 21:53:04 0 [Note] Starting MariaDB 10.6.12-MariaDB-log source revision 4c79e15cc3716f69c044d4287ad2160da8101cdc as process 50025
Cannot find checkpoint record at LSN (1,0x7fee)
2023-04-04 21:53:04 0 [ERROR] mariadbd: Aria recovery failed. Please run aria_chk -r on all Aria tables (.MAI) and delete all aria_log.######## files
2023-04-04 21:53:04 0 [ERROR] Plugin 'Aria' init function returned error.
2023-04-04 21:53:04 0 [ERROR] Plugin 'Aria' registration as a STORAGE ENGINE failed.
2023-04-04 21:53:04 0 [Note] InnoDB: Compressed tables use zlib 1.2.13
2023-04-04 21:53:04 0 [Note] InnoDB: Number of pools: 1
2023-04-04 21:53:04 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
2023-04-04 21:53:04 0 [Note] mariadbd: O_TMPFILE is not supported on /var/tmp (disabling future attempts)
2023-04-04 21:53:04 0 [Note] InnoDB: Using Linux native AIO
2023-04-04 21:53:04 0 [Note] InnoDB: Initializing buffer pool, total size = 268435456, chunk size = 134217728
2023-04-04 21:53:04 0 [Note] InnoDB: Completed initialization of buffer pool
2023-04-04 21:53:04 0 [Note] InnoDB: 128 rollback segments are active.
2023-04-04 21:53:04 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2023-04-04 21:53:04 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2023-04-04 21:53:04 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2023-04-04 21:53:04 0 [Note] InnoDB: 10.6.12 started; log sequence number 14625851; transaction id 7248
2023-04-04 21:53:04 0 [Note] Plugin 'FEEDBACK' is disabled.
2023-04-04 21:53:04 0 [Note] InnoDB: Loading buffer pool(s) from /config/databases/ib_buffer_pool
2023-04-04 21:53:04 0 [ERROR] Could not open mysql.plugin table: "Unknown storage engine 'Aria'". Some plugins may be not loaded
2023-04-04 21:53:04 0 [Note] InnoDB: Buffer pool(s) load completed at 230404 21:53:04
2023-04-04 21:53:04 0 [ERROR] Failed to initialize plugins.
2023-04-04 21:53:04 0 [ERROR] Aborting
230404 21:53:04 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
230404 21:53:05 mysqld_safe Starting mariadbd daemon with databases from /config/databases
2023-04-04 21:53:05 0 [Note] Starting MariaDB 10.6.12-MariaDB-log source revision 4c79e15cc3716f69c044d4287ad2160da8101cdc as process 50232
Cannot find checkpoint record at LSN (1,0x7fee)
2023-04-04 21:53:05 0 [ERROR] mariadbd: Aria recovery failed. Please run aria_chk -r on all Aria tables (.MAI) and delete all aria_log.######## files
2023-04-04 21:53:05 0 [ERROR] Plugin 'Aria' init function returned error.
2023-04-04 21:53:05 0 [ERROR] Plugin 'Aria' registration as a STORAGE ENGINE failed.
2023-04-04 21:53:05 0 [Note] InnoDB: Compressed tables use zlib 1.2.13
2023-04-04 21:53:05 0 [Note] InnoDB: Number of pools: 1
2023-04-04 21:53:05 0 [Note] InnoDB: U
@ssddanbrown commented on GitHub (Apr 9, 2023):
Hi @samundo,
Looks like your MariaDB container system has somewhat gone wrong. I can only advise stopping all containers, ensure you have a secure off-machine backup of all container data, then follow the guidance in the error log, specifically:
Would probably be a case of accessing bash shell in the database container, then find any
*.MAIfiles within the/configdirectory and run thataria_chk -r <file>command on them. Docs for that command here. Then find and delete anyaria_log.*files within that directory as suggested. Then restart the database container and see if the logs show it coming back up safely.@ssddanbrown commented on GitHub (Apr 17, 2023):
Since there's been no follow-up I'm going to close this. If the issue remains and is something you still require to be fixed respond to my previous comment and this can then be re-opened.
@samundo commented on GitHub (Apr 25, 2023):
Hi @ssddanbrown,
Sorry have been away for work. Just an update did the fix from above and now all working. Does not work in Safari but works in all other browsers. Thanks for all your help.
@samundo commented on GitHub (Apr 25, 2023):
Hi @ssddanbrown,
The database is now saying it needs upgrade. Should I run the upgrade?
So far BookStack is working and all data is there.
@ssddanbrown commented on GitHub (Apr 25, 2023):
@samundo I'm not sure what that's referring to. I'd need to see the message to understand where that's coming from and to advise.
@samundo commented on GitHub (Apr 25, 2023):
Hi @ssddanbrown,
When I check the logs under the bookstack database it shows the following message.
@ssddanbrown commented on GitHub (Apr 25, 2023):
@samundo
Okay, so that's all on the database side.
I'd probably follow what it advises but first stop all containers then backup all volumes just in case things go wrong.