3

I have a script that I run to create a Wordpress website. All runs well until I get to the:

wp core install --title=$client --url=$client.local --admin_user=$clientshort-admin --admin_password=******** --admin_email=********@gmail.com

I get the following:

Warning: mysqli_real_connect(): (HY000/2002): No such file or directory in /Applications/MAMP/htdocs/pndesign2/web/wp/wp-includes/wp-db.php on line 1488
Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /Applications/MAMP/htdocs/pndesign2/web/wp/wp-includes/wp-db.php on line 1518
Warning: mysql_connect(): No such file or directory in /Applications/MAMP/htdocs/pndesign2/web/wp/wp-includes/wp-db.php on line 1518
Error: Error establishing a database connection

THanks!

Pete Norris
  • 1,056
  • 7
  • 24
  • 36
  • Have you used mysqli in the past? – Shawn Mehan Dec 16 '15 at 15:55
  • I've used this script hundreds of times - I am assuming by your answer mySQLi is new to this version of MAMP? – Pete Norris Dec 16 '15 at 15:59
  • Not certain - haven't used it- but that's where I would start – Shawn Mehan Dec 16 '15 at 16:04
  • Looks like it points to fact that mysqli extension is not enabled in MAMP - If that is it then I can't find anywhere how to enable it. I'm using MAMP Pro if that helps – Pete Norris Dec 16 '15 at 16:43
  • Revert to previous version of MAMP - Crappy solution but nothing else presents itself. – Pete Norris Dec 17 '15 at 10:55
  • I think you should look into the MAMP folder inside the php folder on the php.ini configuration file. Go to extensions section and see if there are the mysql extension enabled. Your problem isn't about the mysqli_* extension that was just a warning. You have a connection problem with your current mysql version. Maybe the problem isn't the wp at all just the mysql permissions. – Jorge Campos Dec 18 '15 at 16:51
  • I have found the file for the version of PHP I am using 5.6.1 but could you be clearer as to where I should look? all I could find was: ; Extensions ;extension=apcu.so extension=imap.so extension=yaz.so extension=mcrypt.so extension=gettext.so extension=pgsql.so extension=pdo_pgsql.so ;extension=imagick.so ;extension=tidy.so ;extension=oauth.so – Pete Norris Dec 18 '15 at 16:57

1 Answers1

1

After going round in circles, it was down to the PHP version differences between OSX/MAMP/ and WP-CLI. Updating your .bash_profile with the version of MAMP solves it - more details here How to override the path of PHP to use the MAMP path?

Community
  • 1
  • 1
Pete Norris
  • 1,056
  • 7
  • 24
  • 36