PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, February 18, 2022

[FIXED] How to enable TCP on MAMP?

 February 18, 2022     mamp, mysql     No comments   

Issue

I'm trying to run cake in the command line and I'm getting this error

PDO::__construct(): [2002] Connection refused (trying to connect via tcp://127.0.0.1:3306)

I did some research and it turns out that TCP is not turned on automatically with MAMP.

I looked around to see if I could locate a mysql conf file but I could not.

I am using Mamp 2.1.1 on OSX 10.8.2

Does anyone know what I need to do to enable TCP on MAMP, and how to do it? (I am not using MAMP PRO)

Thanks in advance.


Solution

If you really want to connect over TCP, you need to enable networking in your mysql config file, by removing the skip-networking line.

Instead of enabling networking, if you're only going to talk to mysql on the local machine you can connect over a local socket. In place of the tcp connection, give PDO the socket name, like mysql:unix_socket=/Applications/MAMP/tmp/mysql/mysql.sock This will work without any changes to MAMP's defaults.



Answered By - whamma
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing