Search code examples
mysqlbenchmarkingstress-testing

Can I use mysqlslap on an existing database?


Can I use mysqlslap to test specific databases/tables? Or just the mysqlslap database?


Solution

  • To test a specific database, use the --create-schema option. The options name is a bit misleading, as it does not create the schema if it already exists.

    mysqlslap --create-schema=yourdatabase --no-drop --user=myuser -p
    

    CAUTION: If you combine --create-schema with --auto-generate-sql and forget to add --no-drop, the schema is dropped after completion. See official docs for more info.