I wanted to use homewbrew install and mysql8. It seems that there are issues, but I figure the most basic setup with work where I can connect from a localhost tcp/ip connection into mysql on port 3306.
It looks like mysql has networking disabled but I can’t tell from the configuration that this is the case.
I wanted to setup a java program with tomcat8 and latest mysql driver on the same machine and connect to mysql but getting connection refused errors.
But it looks like the main cause is that the homebrew mysql install 8 isn’t running on port 3306 but config says port 0.
I did the recent install:
brew cleanup
brew update
brew install mysql
brew services start mysql
brew services stop mysql
And mysql runs. I can connect to the client but the program does not connect.
…
I navigate to the configuration directory and open my.cnf.
/usr/local/etc
You can see I tried different configurations, but still the server wont run on 3306:
# Default Homebrew MySQL server config
[mysqld]
# Only allow connections from localhost
#bind-address = 127.0.0.1
bind-address = 0.0.0.0
#bind-address= 10.0.0.61
#mysqlx-bind-address = 127.0.0.1
mysqlx-bind-address = 0.0.0.0
port = 3306
socket = /tmp/mysql.sock
#skip-networking=OFF
#skip-external-locking
…
When I check the server status I see:
mysql server status
line-numbers TRUE
unbuffered FALSE
column-names TRUE
sigint-ignore FALSE
port 0
prompt mysql>
quick FALSE
raw FALSE
reconnect TRUE
Homebrew 4.2.21
mysql Ver 8.3.0 for macos13.6 on x86_64 (Homebrew)
macos ventura: 13.6.4
When I run this to check 3306, nothing is running:
lsof -i :3306
sudo lsof -i -n -P | grep 3306
And here is the java code and error:
>> ReadRecords - sys prop token : url: jdbc:mysql://0.0.0.0:3306/zri?serverTimezone=UTC ; user: botlist
Loading SCENARIO: 3
com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
at com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64)
at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:835)
private static final String url = "jdbc:mysql://0.0.0.0:3306/zri?serverTimezone=UTC";
conn = DriverManager.getConnection(url, usr, pwd);