When I download a new wordpress from wordpress.org and then paste it into my www folder of WAMP, then create a new database in phpmyadmin, then go to localhost and click the
For Mariadb hostname should be localhost:3306 and for MySQL localhost:3308.this fixed my error.