Files
claudetools/scripts/fix-mariadb-setup.sh
Mike Swanson 25f3759ecc [Config] Add coding guidelines and code-fixer agent
Major additions:
- Add CODING_GUIDELINES.md with "NO EMOJIS" rule
- Create code-fixer agent for automated violation fixes
- Add offline mode v2 hooks with local caching/queue
- Add periodic context save with invisible Task Scheduler setup
- Add agent coordination rules and database connection docs

Infrastructure:
- Update hooks: task-complete-v2, user-prompt-submit-v2
- Add periodic_save_check.py for auto-save every 5min
- Add PowerShell scripts: setup_periodic_save.ps1, update_to_invisible.ps1
- Add sync-contexts script for queue synchronization

Documentation:
- OFFLINE_MODE.md, PERIODIC_SAVE_INVISIBLE_SETUP.md
- Migration procedures and verification docs
- Fix flashing window guide

Updates:
- Update agent configs (backup, code-review, coding, database, gitea, testing)
- Update claude.md with coding guidelines reference
- Update .gitignore for new cache/queue directories

Status: Pre-automated-fixer baseline commit

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-17 12:51:43 -07:00

67 lines
2.2 KiB
Bash

#!/bin/bash
#
# Fix MariaDB setup after initial installation
#
set -e
echo "=========================================="
echo "Fixing MariaDB Setup"
echo "=========================================="
echo ""
# Secure installation using sudo mysql (unix_socket auth)
echo "[1/4] Securing MariaDB installation..."
sudo mysql <<'EOF'
ALTER USER 'root'@'localhost' IDENTIFIED BY 'CT_rmm_root_2026';
DELETE FROM mysql.user WHERE User='';
DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');
DROP DATABASE IF EXISTS test;
DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%';
FLUSH PRIVILEGES;
EOF
echo "✓ MariaDB secured"
echo ""
# Create ClaudeTools database
echo "[2/4] Creating ClaudeTools database..."
sudo mysql -u root -pCT_rmm_root_2026 <<'EOF'
CREATE DATABASE IF NOT EXISTS claudetools CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER IF NOT EXISTS 'claudetools'@'172.16.3.%' IDENTIFIED BY 'CT_e8fcd5a3952030a79ed6debae6c954ed';
GRANT ALL PRIVILEGES ON claudetools.* TO 'claudetools'@'172.16.3.%';
CREATE USER IF NOT EXISTS 'claudetools'@'localhost' IDENTIFIED BY 'CT_e8fcd5a3952030a79ed6debae6c954ed';
GRANT ALL PRIVILEGES ON claudetools.* TO 'claudetools'@'localhost';
FLUSH PRIVILEGES;
EOF
echo "✓ Database and users created"
echo ""
# Configure for network access
echo "[3/4] Configuring MariaDB for network access..."
sudo sed -i 's/bind-address\s*=\s*127.0.0.1/bind-address = 0.0.0.0/' /etc/mysql/mariadb.conf.d/50-server.cnf
sudo systemctl restart mariadb
echo "✓ Network access configured"
echo ""
# Test connection
echo "[4/4] Testing connection..."
mysql -h localhost -u claudetools -pCT_e8fcd5a3952030a79ed6debae6c954ed -e "SELECT 'Connection successful!' AS status, DATABASE() AS current_db;"
echo "✓ Connection test passed"
echo ""
echo "=========================================="
echo "MariaDB Setup Complete!"
echo "=========================================="
echo ""
echo "Database: claudetools"
echo "User: claudetools"
echo "Password: CT_e8fcd5a3952030a79ed6debae6c954ed"
echo "Host: 172.16.3.30:3306"
echo ""
echo "Next: Test from Windows with:"
echo " mysql -h 172.16.3.30 -u claudetools -pCT_e8fcd5a3952030a79ed6debae6c954ed claudetools"
echo ""