Fix bugs when using MySQL as index database

1. MySQLdb will raise ProgrammingError when table doesn't exists. Use engine.has_table to check whether table exists for compatible
2. VARCHAR requires a length on dialect mysql. String length limit is according to [Docker Hub's limit](https://registry.hub.docker.com/account/repositories/add/) and [docker's valid namespace and repo regex](https://github.com/docker/docker/blob/master/registry/registry.go#L214)