Hi! Me and my team are working on a local website. We have made a backup of our old website and want to import it to this new local website we are working on at the moment. However, when importing it, we came across a problem which was denied access to our data base. It asks for a password that we don’t have. We don’t know what to do. Any advice? Thank you!
On your server, you can use
wp db export to generate a quick SQL dump for you to import locally.
Move the database export to your Local site folder, inside
\app\public path. Give it an easy name, I like
db.sql as it’s short and easy to remember. To know the proper path where to copy, just press the
Go to site path button inside Local GUI and then go inside
Then you’ll need to open a Shell using the
Open site shell button in your Local GUI. It should already put you in the same
public path where you put your db export SQL file.
Then use the
mysql CLI command to get inside of the MySQL server. Then
use local; to select the local database and then
source db.sql to import the database. In the end, type
exit; to exit the MySQL terminal and you should be done.
Now your local site will redirect to the site on the server, because the paths in the wp_options table are still pointing to that. To fix this you have 2 options:
- Fix it via a search-replace using the
wpcli tool, docs here: wp search-replace | WP-CLI Command | WordPress Developer Resources, or;
- Add in your wp-config.php the override paths as described here: Changing The Site URL – WordPress.org Forums