Absolutely, categorically do NOT attempt to connect to the database directly.Doing so violates your IBM Support agreement and would lead to your support agreement being terminated. And yes we can tell when you have done so when you raise a Support Case.The portal database is an internal component and it is NEVER allowed to connect to it directly.If you want to look at the data in it then you can do so via supported drupal database APIs in a custom module, but in this case you don't need to go that low level. The custom fields will be viewable from the UI, you don't need to go messing around in the database. If you want to export a report of all the data then just create a View (Structure->Views) and you can even export it as JSON/CSV whatever.
The custom field data will also be sent to api manager as part of the 'metadata' array map that exists on users, applications, consumer orgs etc... So you can even retrieve the data using the public API Manager APIs.Do NOT connect to mysql. I really cannot stress that enough.