Topics

Tribe Support

Tribe Support's Topics

Unknown Person

October 21 2015

local setup failing on mysql connect

i'm attempting to setup anahita on my local machine for dev testing. i've got to the site:init step and it asks for basic MySQL info which i provide. however no matter what i try i get the sql connection error: Unable to connect to the database:Could not connect to MySQL.

i can connect manually with mysql command line using the provided data. the database exists and everything is absolutely correct. i cannot figure out why this is happening. is it trying to use mysqli instead of mysql? my dev machine satisfies all the requirements. i am using a MAMP setup.

#mysqli #mamp #installation

Rastin Mehr
Rastin Mehr
October 21 2015 Permalink
Are you using the latest version of MAMP? It does come with mysqli installed https://secure.php.net/manual/en/book.mysqli.php
Unknown Person
October 21 2015 Permalink
i am - 3.4 up to date. phpinfo shows full mysqli support enabled. how does the site:init script try to connect to the db?
Rastin Mehr
Rastin Mehr
October 21 2015 Permalink
check your php.ini file and see if mysqli extension is there
Rastin Mehr
Rastin Mehr
October 21 2015 Permalink
also there is a chance that your command line isn't using the same php as MAMP does.
Rastin Mehr
Rastin Mehr
October 21 2015 Permalink
type:

$ php -i

and it will show the complete phpinfo() to you
Unknown Person
October 21 2015 Permalink
yes, it appears as though this is the case. is there a reason that the requirements don't say mysqli instead of mysql?
Unknown Person
October 21 2015 Permalink
also - it is not altogether obvious how to get mysqli enabled for command line php. the choice to only allow installation via command-line is a strange one indeed.
Unknown Person
October 21 2015 Permalink
according to php -i and php -m mysqli is enabled via command line.
Unknown Person
October 21 2015 Permalink
finally got it working.

i had to transfer the settings from MAMP's php.ini to the command-line php.ini for mysqli in full - particularly the default socket value.

i'm still baffled why command-line installation is the only option here. this forced me to have to duplicate configuration across two php environments. all other site installations are smooth and easy. command-line installation is not the best choice!
Rastin Mehr liked this
Rastin Mehr
Rastin Mehr
October 21 2015 Permalink
Awesome! I'm glad you worked it out.

Powered by Anahita