DEV Community

Clarence Dimitri CHARLES
Clarence Dimitri CHARLES

Posted on

TestContainers and Mysql : Access denied for user ''@'172.17.0.1' (using password: NO)

I wrote a simple repository to test Kotlin Exposed with TestContainers. The database that I use is mysql.

Here is my code :

class StudentsRepositoryTest: ShouldSpec({
     val container = getMysqlContainer()
     val mysqlJdbcUrl = container.jdbcUrl
     beforeSpec {
        Database.connect(mysqlJdbcUrl, "com.mysql.cj.jdbc.Driver")
        transaction {
            SchemaUtils.create(Students)
        }
     }

     ... // some tests


     private fun getMysqlContainer():

Top comments (0)