Setting key-auth values

When setting up key-auth for different consumers, is there any way I can get the the key values from our DB (mysql)? With SQL statements? Or I need to write a script to automate it? Thanks!