I am trying to get a local drupal environment up and running using an sql dump from a production environment. I am attempting to follow instructions from drupal's documentation.
So far, from our production server, I went ahead and ran
drush sql-dump > prod_drupal_backup.sql. Then, I used
scp to pull the prod_drupal_backup.sql file from the production server.
On my local machine, using MAMP, I created a database (prod_drupal, same as the database on the production server) and gave a user, admin, access to the database. I went ahead and pulled down the codebase and created a fresh Drupal instance. During this set up, I gave Drupal the admin credentials to connect to the database and had a fresh site up and running.
With a backup, I was ready to restore the database using the prod_drupal_backup.sql SQL dump file. So I went and ran
/Applications/MAMP/Library/bin/mysql -uroot prod_drupal < ~/Desktop/db_backup.sql. After this completed, I checked the database via MAMP's localhost:8888/phpmyadmin. The prod_drupal database had the correct data in it. So then I went to the website (localhost:8888) and saw what I wanted, the login screen with all of our styling and everything. When I logged in using one of the accounts registered for the site, it thrown the The website encountered an unexpected error. Please try again later. error.
When I look at my MAMP sql error logs in mysql_error.log, I see errors like access denied for user 'mikesmith@localhost'. This makes zero sense because Drupal is supposed to be connecting to the database with admin, not
mikesmith. The way Drupal is trying to connect to the database doesn't match what's in the settings.php file.
What am I doing wrong?
I am using MAMP Pro 5.5.1 and PHP 7.2.21, if this makes any difference.
sites/default/? I have also noticed that if I just type in
mysqlinto my command line, I get the error
access denied to user 'mikesmith@localhost'...
active useron my Mac, instead of the user I defined in settings.php...