MAMP Pro: How to connect to MySql server on Mac OS via network?

I have a computer with Mac OS 10.6 that runs as a web server on a local network. I am using MAMP Pro for this (Apache + MySql).

Today I have a problem: from another PC on the local network, I try to connect to the Mysql server on Mac and an error occurred:

2003 - Unable to connect to MySQL server on '192.168.1.10' (10061)

I am sure that uncheck the "Allow only local access" checkbox on the MySql tab on MAMP Pro and the firewall is turned off.

I am trying to use nmap to scan a web server, and port 3306 is not listed in the results.

Hope someone can help!

Thanks!

+4
source share
2 answers

By default, MySQL is limited to connecting only to localhost (127.0.0.1) due to some security reason. if you want remote access to MySQL, you need to change the default my.cnf value.

open the my.cnf file located in

Applications / MAMP / TMP / MySQL / my.cnf

and edit the following

bind-address = 127.0.0.1

to

bind-address = 0.0.0.0

save the file and restart the mysql server by entering the following command in your terminal

sudo / etc / init.d / mysql restart

your MySQL server should now have network access. to verify that it is listening on the entire type of interface in the terminal

netstat -anp | grep 3306 

and if you answer that it works,

 tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN - 

the above information is taken from this link: http://rclermont.blogspot.in/2008/05/configuring-mysql-for-network-access.html

hope this helps

+13
source

I followed Ibrahim's answer, but the file is no longer on this path. I executed the following command in Mac Mojave

 $ mdfind -name my.cnf /usr/local/etc/my.cnf $ vim /usr/local/etc/my.cnf 

Then made changes

 bind-address = 0.0.0.0 
0
source

Source: https://habr.com/ru/post/1399132/


All Articles