10 November 2025
Diari

Fix – Something bad happened when creating new WordPress site using DevKinsta + Docker

I faced an error when creating a new site on DevKinsta, something like “Something bad happened – step 2″ when creating new WordPress site using DevKinsta + Docker” I’m using MariaDB 10, and I created a script that can fix this issue based on the error log. Hopefully, this helps anyone who encounters the same problem.

#!/bin/bash
# ==========================================================
# Fix DevKinsta database connection
# mariadb 10.* and below
# change DB_PASS with your own password in devkinsta_db > inspect
# ==========================================================

DB_USER="root"
DB_PASS="aiqOAcxcWp1kSY1V"

echo "Checking DevKinsta database container..."

# Ensure DB container is running
if ! docker ps | grep -q devkinsta_db; then
  echo "devkinsta_db is not running. Starting it..."
  docker start devkinsta_db >/dev/null 2>&1
  sleep 3
fi

echo "devkinsta_db container is running."

# Fix MariaDB authentication plugin + password format
echo "Fixing MariaDB authentication..."
docker exec -i devkinsta_db bash <<EOF
mysql -u root -p${DB_PASS} -e "
USE mysql;
UPDATE user SET plugin='mysql_native_password' WHERE User='${DB_USER}';
SET PASSWORD FOR '${DB_USER}'@'localhost' = PASSWORD('${DB_PASS}');
SET PASSWORD FOR '${DB_USER}'@'%' = PASSWORD('${DB_PASS}');
FLUSH PRIVILEGES;
"
EOF

# Restart containers
echo "Restarting containers..."
docker restart devkinsta_db devkinsta_fpm >/dev/null 2>&1

# Test DB connection from PHP container
echo "Testing DB connection..."
docker exec -i devkinsta_fpm bash <<EOF
mysql -h devkinsta_db -u ${DB_USER} -p${DB_PASS} -e "SELECT 'Database connection successful!' AS status;"
EOF

echo ""
echo "Done! Database connection should now be working."
echo "If you still see 'Error establishing a database connection' in WordPress,"
echo "make sure your wp-config.php has:"
echo ""
echo "  define( 'DB_HOST', 'devkinsta_db' );"
echo "  define( 'DB_USER', 'root' );"
echo "  define( 'DB_PASSWORD', '${DB_PASS}' );"
echo ""
echo "Then restart DevKinsta and try again."

1. Save this to script shell file. example: fix-sbh-error-database.sh

2. Change script permission

chmod +x fix-sbh-error-database.sh

3. Run it! before that make sure devkinsta_db is running.

./fix-sbh-error-database.sh

That’s it, try create you site again. It should work.

Leave the first comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.