Move mysql related stuff to seperate file