Run XAMPP and "local" installation of MySQL

Problems with the Mac OS X version of XAMPP, questions, comments, and anything related.

Run XAMPP and "local" installation of MySQL

Postby pir » 30. November 2010 11:47

Hi!
I'm pretty new to databases and started to use XAMPP and it works great. I have a local website that is using a database. I would like to be able to run PHP scripts in my terminal which updates the database used by the website. When I run my scripts in the terminal the following warning is printed: "PHP Warning: mysql_connect(): [2002] No such file or directory (trying to connect via unix:///var/mysql/mysql.sock) ". I guess that this is because XAMPP has installed MySQL in some other location than the one normally used by the PHP installation on my Mac.

What I'm thinking is that I should install MySQL "locally" on my Mac. What I am wondering is if this would create problems with my MySQL databases which are accessed from XAMPP. Can I access the same databases from both my XAMPP installation of MySQL and my "local" installation of MySQL. I still want to use XAMPP since I using it when testing my website. So I want the two installations of MySQL function in parallell using the same databases.
Or is there some other more easier solution to my problem?

Please tell me if my question is unclear or if I'm doubleposting a question. I have searched the forum, but without any success.

thanks
pir
pir
 
Posts: 5
Joined: 30. November 2010 11:28

Re: Run XAMPP and "local" installation of MySQL

Postby MegaChriz » 30. November 2010 15:27

Hi pir,

I have no experience with running PHP scripts in the Terminal (I usually place PHP-scripts that I want to run in a folder accessible by the webserver - for example the htdocs folder - and then run the script within a browser).

However, I do know where the mysql that comes with XAMPP is located:
/Applications/XAMPP/xamppfiles/var/mysql

Although I have no experience with it, I think it will be hard to install MySQL on a different location and then link XAMPP with it. I've read that some of the paths in XAMPP are hardcoded (but I don't know which ones), so it might be even impossible.

I guess it's the easiest to point to /Applications/XAMPP/xamppfiles/var/mysql/mysql.sock in the Terminal, if that works.

MegaChriz
MegaChriz
 
Posts: 158
Joined: 16. February 2009 15:04
Location: Amersfoort, The Netherlands
Operating System: Mac OS X

Re: Run XAMPP and "local" installation of MySQL

Postby pir » 03. December 2010 10:44

Thanks MegaChriz!
It worked really well. What I did was to set the mysql default socket to point to the mysql.sock located in /Applications/XAMPP/xamppfiles/var/mysql/mysql.sock, as you wrote, in the php.ini on my system. That was the only change I needed to do. This saves me a lot of time not needing to run my database scripts in the browser.

BR
pir
pir
 
Posts: 5
Joined: 30. November 2010 11:28


Return to XAMPP for macOS

Who is online

Users browsing this forum: No registered users and 44 guests