So I will give you the steps I did:
1- Take a backup copy of your website files and save them on your device.
2- Take a backup copy of the database from the Cpanel, not from Phpmyadmin, where you go to Backup, choose the database and download it to your computer.
3- Put the site files in htdocs file and then log in to phpmyadmin of localhost and import the database.
4- Edit the config.php file and then open your site through the browser, it should work now without the need to fix any of the tables.
5- If the site works correctly, enter the admin control panel and modify the site link in the general, and if software errors appear, enter the plug-ins folder and delete all plugins temporarily until you are sure of the source of the error, because often the plugins do not work correctly on the local server.
Note: The link to the site is completely, for example: http://localhost/ask