Where is the link between a CiviCRM contact and Wordpress user stored in the database?
Great question!
The matching between the CMS user and the CiviCRM contacts relies, like most &quot;relationships&quot; between entities in CiviCRM, on an additional table that maps the IDs between the two entity types.
For the Contact to CMS User match you're looking for the civicrm_uf_match table. This table has the following columns:

ID - this is the Unique ID of the match record.
DOMAIN_ID - this is the Unique ID of the CiviCRM domain in a multisite setup.
UF_ID - this is the User's ID in the &quot;UserFramework (UF)&quot; (this is what CiviCRM calls the CMS).
UF_NAME - this is the User's Username or Email address in the UserFramework.
CONTACT_ID - this is the Unique ID of the CiviCRM contact that matches to the User.

Hope this helps!