Skip to content

Comments

Fix database permissions for localhost connections#270

Closed
pwtyler wants to merge 1 commit intowp-cli:mainfrom
pwtyler:fix-localhost-database-permissions
Closed

Fix database permissions for localhost connections#270
pwtyler wants to merge 1 commit intowp-cli:mainfrom
pwtyler:fix-localhost-database-permissions

Conversation

@pwtyler
Copy link

@pwtyler pwtyler commented Sep 5, 2025

Summary

  • Adds explicit localhost permissions for all three database setup functions
  • Fixes connection errors when tests try to connect via localhost
  • MySQL/MariaDB treats @'localhost' and @'%' as different host patterns

Problem

The current script only creates users with @'%' permissions, but when tests connect via localhost, they get "Access denied" errors. Encountered when running behat tests on search-replace.

Solution

Added CREATE USER and GRANT statements for @'localhost' in:

  • install_mysql_db_8_0_plus()
  • install_mysql_db_lower_than_8_0()
  • install_mariadb()

Testing

  • Tested with MariaDB 11.8
  • Verified localhost connections work after running install-package-tests
  • Confirmed existing behat tests run

@codecov
Copy link

codecov bot commented Sep 5, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@pwtyler pwtyler marked this pull request as ready for review September 5, 2025 21:27
@pwtyler pwtyler requested a review from a team as a code owner September 5, 2025 21:27
@pwtyler
Copy link
Author

pwtyler commented Sep 8, 2025

https://mariadb.com/docs/server/mariadb-quickstart-guides/mariadb-connection-troubleshooting-guide#localhost-vs.-wildcard-host-issues

Nevermind, looks like I had a local anonymous user blocking this from working.

@pwtyler pwtyler closed this Sep 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant