more logic on mysql_connect
implemented next_unused_id
test for next_unused_id using populated database with initial ldif file