This directory contains Docker configuration files to quickly spin up a MySQL server that's compatible with the database_utils.py script.
docker-compose.yml- Docker Compose configuration for MySQLDockerfile.mysql- Standalone Dockerfile for MySQLmysql-init/01-init.sql- MySQL initialization scriptmysql-docker.sh- Management script for easy container operations
# Start MySQL server
docker-compose up -d mysql
# Check if it's running
docker-compose ps
# Stop MySQL server
docker-compose down# Make script executable (already done)
chmod +x mysql-docker.sh
# Start MySQL
./mysql-docker.sh start
# Check status
./mysql-docker.sh status
# Connect to MySQL shell
./mysql-docker.sh connect
# View logs
./mysql-docker.sh logs
# Stop MySQL
./mysql-docker.sh stop
# Restart MySQL
./mysql-docker.sh restart
# Reset (delete all data and start fresh)
./mysql-docker.sh reset# Build custom image
docker build -f Dockerfile.mysql -t leangraph-mysql .
# Run container
docker run -d \
--name leangraph-mysql \
-e MYSQL_ROOT_PASSWORD=123 \
-e MYSQL_DATABASE=leanrag_default \
-p 4321:3306 \
-v mysql_data:/var/lib/mysql \
leangraph-mysqlThe MySQL server will be available with these connection parameters (matching database_utils.py):
- Host:
localhost - Port:
4321 - User:
root - Password:
123 - Default Database:
leanrag_default - Character Set:
utf8mb4 - Collation:
utf8mb4_unicode_ci
The database_utils.py script will automatically create these tables:
- entities - Entity information with descriptions, source IDs, degrees, parents, and levels
- relations - Relationship data between entities with descriptions, weights, and levels
- communities - Community data with entity names, descriptions, and findings
# Check Docker logs
docker logs leangraph-mysql
# Or use the management script
./mysql-docker.sh logs# Make sure container is running
./mysql-docker.sh status
# Check if port 4321 is available
netstat -an | grep 4321
# Try connecting manually
mysql -h localhost -P 4321 -u root -p123# This will delete all data and start fresh
./mysql-docker.sh reset# Make sure the script is executable
chmod +x mysql-docker.shMySQL data is stored in a Docker volume named mysql_data. This means your data will persist even if you stop and restart the container. To completely reset the database, use:
./mysql-docker.sh resetOr manually remove the volume:
docker volume rm mysql_data