The system automatically creates a default administrator account on first run:
Username: admin
Password: admin123
Change the default admin password immediately after installation. The default credentials are well-known and pose a security risk in production environments.
All tables are created automatically when the application first runs. The config.php file contains CREATE TABLE IF NOT EXISTS statements for each table.
-- Find students in class_students but not in students tableSELECT cs.*FROM class_students cs LEFT JOIN students s ON cs.student_id = s.student_idWHERE s.student_id IS NULL;-- Find attendance for non-existent studentsSELECT a.*FROM attendance a LEFT JOIN students s ON a.student_id = s.student_idWHERE s.student_id IS NULL;
SELECT (SELECT COUNT(*) FROM students) as total_students, (SELECT COUNT(*) FROM teachers) as total_teachers, (SELECT COUNT(*) FROM classes) as total_classes, (SELECT COUNT(*) FROM attendance WHERE date = CURDATE()) as today_attendance;
Recent activity:
-- Recent attendance recordsSELECT a.*, s.name as student_name, c.name as class_nameFROM attendance aJOIN students s ON a.student_id = s.student_idJOIN classes c ON a.class_id = c.idORDER BY a.date DESC, a.time DESCLIMIT 20;
Slow query log:
Enable MySQL slow query log to identify performance issues:
SET GLOBAL slow_query_log = 'ON';SET GLOBAL long_query_time = 2;SET GLOBAL slow_query_log_file = '/var/log/mysql/slow-query.log';
Index analysis:
-- Check if indexes are being usedEXPLAIN SELECT * FROM attendance WHERE student_id = 'S12345';EXPLAIN SELECT * FROM class_students WHERE class_id = 1;
Grant only necessary privileges to application database user
Don’t use root account for application connections
Enable MySQL audit logging for production
-- Create dedicated database userCREATE USER 'qr_attendance_app'@'localhost' IDENTIFIED BY 'strong_password';GRANT SELECT, INSERT, UPDATE, DELETE ON qr_attendance.* TO 'qr_attendance_app'@'localhost';FLUSH PRIVILEGES;