Themes Development – I have installed WordPress on the main domain, how can I configure it on its subdomain using the same database?

I have a website www.domain.com with WordPress installed. I need to create a subdomain to test a new theme and link it to the main site database. I manually added the WordPress files in the subdomain and when installing in the browser, I added the database information from the main site. However, when I then try to finish the installation, it indicates that I have already installed WordPress and will connect me to the main site. When I do it, there is no option to display the subdomain.

How to link the subdomain to the main site database and operate it autonomously?