tidbstandalone/test-connection.sh

36 lines
995 B
Bash
Executable File

#!/bin/bash
echo "🔌 Testing TiDB Connection..."
echo ""
# Check if TiDB container is running
if ! docker ps | grep -q tidb; then
echo "❌ TiDB container is not running"
echo " Start it with: ./start.sh"
exit 1
fi
echo "✅ TiDB container is running"
echo ""
# Test connection
echo "🧪 Testing MySQL connection on 127.0.0.1:4000..."
if docker exec tidb mysql -h 127.0.0.1 -P 4000 -u root -e "SELECT VERSION();" 2>/dev/null; then
echo ""
echo "✅ Connection successful!"
echo ""
echo "📊 Available databases:"
docker exec tidb mysql -h 127.0.0.1 -P 4000 -u root -e "SHOW DATABASES;" 2>/dev/null
echo ""
echo "🎯 Connection Settings:"
echo " Host: 127.0.0.1"
echo " Port: 4000"
echo " User: root"
echo " Password: (leave empty)"
echo ""
echo "📖 See DATAGRIP_SETUP.md for detailed instructions"
else
echo ""
echo "❌ Connection failed"
echo " Check TiDB logs: docker logs tidb"
fi