0
votes

I created a Drupal website in a XAMPP environment, but would like to further develop it in a MAMP environment. That is, without losing all the content I already added. I changed the settings.php file like this

$databases = array (
  'default' => 
  array (
    'default' => 
    array (
      'database' => 'drupal',
      'username' => 'root',
      'password' => 'root',
      'host' => 'localhost:8889',
      'port' => '',
      'driver' => 'mysql',
      'prefix' => '',
    ),
  ),
);

But I get the error:

PDOException: SQLSTATE[HY000] [2005] Unknown MySQL server host 'localhost:8889' (2) in lock_may_be_available() (line 164 of /Applications/MAMP/htdocs/kooknet2/includes/lock.inc).

Does anyone know how I can solve this? Thanks!

3

3 Answers

0
votes

It's a tiny error, you've got the port as part of your host string (:8889) when you should be adding it to the array key that actually says port. Try this:

$databases = array (
  'default' => array (
      'database' => 'drupal',
      'username' => 'root',
      'password' => 'root',
      'host' => 'localhost',
      'port' => '8889',
      'driver' => 'mysql',
      'prefix' => '',
    ),
  ),
);
0
votes

If you have local MySQL server, login to it from console, check user-pass-port. It see,s you haven't MySQL instance on 8899 port

0
votes

I would suggest using the backup and migrate module to grab a copy of your database. Then setup your site on mamp (with a new db/install), and use BAM to restore from your backup.

If you're using the same file path, there shouldn't be any other steps to worry about otherwise you might need to copy/move your files directory and also reconfigure your file path settings in the drupal interface. (Also you may need to be aware that any links to internal content that is embedded in your node body may also need to be adjusted so the path is correct)