Hi Alex,
You can definitely setup a single SimpleSAMLphp installation to be both SP & IdP at the same time, even multiple different SPs and IdPs if you like, as long as you access each of those services through separate FQDNs, and configure SimpleSAMLphp itself to issue cookies correctly for each.
My setup currently consists of a single SimpleSAMLphp installation into which I feed separate PHP "definition" files for each of the services that I host, e.g. 'sp-foo.php', 'idp-bar.php', loading each of them into the corresponding authsource.php, saml20-sp-remote.php, saml20-idp-hosted.php, etc, files as appropriate, with each "definition" file of course containing the correct information to make its service work under the correct FQDN.
As for making the IdP work with MySQL, I'm not too sure what you mean; are you referring to session cookie storage? or user credentials storage? For example, my IdP service is currently configured to provide user authentication to its registered SPs off of an LDAP local source also hosted by the same SimpleSAMLphp installation, among a pool of multiple local auth sources I could use; then the 'auth' key of the IdP service is just configured to use that one auth source.
So for MySQL you could do some like the following in authsources/some-authsource-id.php
$config['some-authsource-id'] =
[
'sqlauth:SQL',
'dsn' => 'mysql:host=theServer;port=thePort;dbname=theDb',
'username' => 'theUser',
'password' => 'thePassword',
'query' => 'theQuery'
];
And then configure your IdP service to use that authsource id, simple as that.
But configuring that authentication source is no different from configuring any other SQL auth source, so reading its documentation should provide you with all of the information that you need.
HTH!