Are you a WordPress beginner and tried to move your website from existing server to new another yourself. Then definitely you might have seen this issue “Can’t select database”. Not wondered if you have spent more than hour to resolve this issue and ask some of your friend for same.
Some times user think they have entered wrong user id and password but if we check the message it clearly states that user id and password entered is correct and problem is with database only.
Here we will help you to save your time by giving exact solution for this issue. Can’t select database issue could be due to two main reasons. We will learn about those reason and how to resolve them?
Database not exist
Primary reason for this error is you might have entered wrong name of database or you have selected the database which doesn’t exist. To resolve this issue, kindly wp-config.php file in root of your wordpress folder and confirm the database name and match with phpadmin. For reference kindly match your wp-config file with below image.
Permission issue for database user
If you have perform your first step and found everything is fine. Then permission issue is the only reason for your error. open your cpanel of your domain. To open cpanel type “/cpanel” after your domain name.
Find “My Database” and open it. In above picture of my cpanel you can see i have two database named growyour_test and growyour_wp. You can see the column of Privilege user which tell us which user have access for database. If you use database growyour_test it will show “can’t select database” because no user is assign to this database, but growyour_wp will work fine.
Now issue is how we grant permission to database, as we are beginner in wordpress we don’t know how to gave permission using console of cpanel which is popular solution while you googling it.
Now best solution for this error is to install wordpress in cpanel. That will create wordpress files and database. Now replace wordpress files with your backup except wp-config and import your database to database created by cpanel and you are done.
Your website will work as usual its working on your previous domain.