I am trying to setup MySql 5.5 server for remote access from Ubuntu host 192.168.1.139, so
I added line: bind-address=192.168.1.139 to the server's config file: /etc/mysql/my.cf
When i tried to restart mysqld, i've got the following error:
[Note] Server hostname (bind-address): '192.168.1.139'; port: 3306
[Note] - '192.168.1.139' resolves to '192.168.1.139';
[Note] Server socket created on IP: '192.168.1.139'.
[ERROR] Can't start server: Bind on TCP/IP port: Cannot assign requested address
[ERROR] Do you already have another mysqld server running on port: 3306 ?
Can anyone help with the problem cause? And how can i open MySQL server for connection from any host/user , e.g. what should be the syntax for that in my.cf?
bind-address is for your local IP addresses or network interfaces. You cannot bind to a remote address. You'll need to set up rules in a firewall in order to do such limitations. Run ifconfig to see what are your network interfaces. Use
bind-address = 0.0.0.0
to allow connections to any interface. I recommend you this post https://serverfault.com/a/139326
I think this message
[ERROR] Do you already have another mysqld server running on port: 3306 ?
can be pretty misleading as this can also be related to the binding address and not the port itsel.
In my case, the database failed to start on system init because I was binding to the 10.0.0.11 IP address, whose interface wasn't ready on startup. To solve it (on MariaDB/Fedora 24):
mkdir /lib/systemd/system/mariadb.service.d
echo "[Unit]
After=network-online.target
Wants=network-online.target
" > /lib/systemd/system/mariadb.service.d/waitForNetwork.conf
Related
MariaDB is installed on server with IP 1.2.3.4, new MySQL user has been created on 1.2.3.4 for remote IP a.b.c.d, but while trying to connect MySQL on 1.2.3.4 from a.b.c.d giving error:
ERROR 2003 (HY000): Can't connect to MySQL server on '1.2.3.4' (111
"Connection refused")
Investigation-:
trying to telnet from a.b.c.d to 1.2.3.4 at port 3306 also not working
surprisingly when trying to connect mysql from 1.2.3.4 directly using server IP 1.2.3.4 is also throwing error "ERROR 2003 (HY000): Can't connect to MySQL server on '1.2.3.4' (111)
While trying to connect mysql using mysql -h localhost -u root -p is successfully working.
What we are looking for, we want to connect mysql from a.b.c.d to 1.2.3.4, please suggest what we are missing.
addtional information:
on server 1.2.3.4 /etc/mysql/my.cnf is not present, there exist '/etc/my.cnf'
trying to find solution we are referring link "webdock.io/en/docs/how-guides/database-guides/…" some edit is mentioned to in file "/etc/mysql/my.cnf" which is not present.
Added from comment below
Firewall has been disabled, user has already created, mariadb.log showing error while binding
221215 17:10:12 [ERROR] Can't start server: Bind on TCP/IP port. Got error: 99: Cannot assign requested address
221215 17:10:12 [ERROR] Do you already have another mysqld server running on port: 3306 ?
221215 17:10:12 [ERROR] Aborting
Some points to consider.
Check firewall (port 3306 should be allowed for the remote ip if you are running MariaDB on 3306 port )
The user should exists (which you have) and it should be something like;
user#your_remote_ip
Check bind-address in the configuration file, if it set to 127.0.0.1 it will allow only localhost login.
It is a good idea to check the logs , usually located on /var/log/mysql/ or you could verify from the configuration file where the logs are located
log_error = /var/log/mysql/error.log
Most probably it might be a firewall issue.
Make sure that the port on which the database server is running is not closed and is exposed publicly.
Also check if the database configurations allow binding IP is not only set to 127.0.0.1 but every IP can bind.
2021-04-27 21:04:35 0 [ERROR] Can't start server: Bind on TCP/IP port. Got error: 10049: The requested address is invalid in this context.
2021-04-27 21:04:35 0 [ERROR] Do you already have another mysqld server running on port: 3306 ?
2021-04-27 21:04:35 0 [ERROR] Aborting
I think you already have another service running on port 3306 and that is why MySQl cannot use it, so two solutions:
Change MySQL port editing mysql.ini (Usually located where MySQL is installed, like C:\Program Files\MySQL\MySQL Server 5.5\my.ini) and change the line port=3306 to use another port number
Identify what service is using that port and kill it:
Use nestat to identify the process is using the port 3306
netstat -aon | findstr 3306
The last column of the result is the process id (PID), use it to identify what application is blocking the port and with that information you can kill/uninstall the app is blocking MySQL.
tasklist | findstr <PID>
I hope this would be helpful.
I have encountered a strange error with MySQL service. I can not start it due to the problem related to ports. I have checked my error logs:
2021-03-18T10:02:22.507114Z 0 [ERROR] [MY-010262] [Server] Can't start server: Bind on TCP/IP port: Cannot assign requested address
2021-03-18T10:02:22.507246Z 0 [ERROR] [MY-010257] [Server] Do you already have another mysqld server running on port: 3306 ?
2021-03-18T10:02:22.508080Z 0 [ERROR] [MY-010119] [Server] Aborting
I have checked some other threads on StackOverflow about this issue, so I decided to try the solutions.
Another mysqld server running on port 3306 error
Do you already have another mysqld server running on port: 3306 Ubuntu
Mysql port already in use
I checked all my ports with:
netstat -tulpn
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:12526 0.0.0.0:* LISTEN 485/sshd
tcp 0 232 172.16.2.34:12526 10.200.0.62:62217 ESTABLISHED 898/sshd: sop [priv
tcp6 0 0 :::80 :::* LISTEN 547/apache2
As you can see, there is nothing associated with port 3306.
To be sure, I checked that with:
lsof -i TCP:3306
I decided to try changing the port that MySQL uses. I opened the configuration file and changed the port to the different one that FOR SURE must be free (again, I checked that).
port = 6606
Unfortunately, it only resulted into changed error log:
2021-03-18T10:22:22.507114Z 0 [ERROR] [MY-010262] [Server] Can't start server: Bind on TCP/IP port: Cannot assign requested address
2021-03-18T10:22:22.507246Z 0 [ERROR] [MY-010257] [Server] Do you already have another mysqld server running on port: 6606 ?
2021-03-18T12:02:22.508080Z 0 [ERROR] [MY-010119] [Server] Aborting
All solutions I have seen, require to kill the program that occupy the port, but how do I am supposed to do so when there is no such program? What else can I consider? I wonder if I will just end up with reinstalling MySQL, because I have no idea what to do with this error...
I would like to admit that MySQL has worked very well so far, and I cannot pinpoint why it suddenly stopped working properly. No significant changes have been made to the system. No services were installed that could started to use ports that MySQL wants to use.
I use MySQL on Linux Debian 10.
Thank you in advance for all your help and time. :)
Check the MySQL service status by running below command:
/etc/init.d/mysqld status
If MySQL service is running then stop the service by running below command
/etc/init.d/mysqld stop
Check if MySQL service port 3306 is still in use or not by running below command:
netstat -apn | grep 3306
If MySQL service is found running in step 3 then kill the service using below command:
kill -9 pid
Start the MySQL service using below command:
/etc/init.d/mysqld start
I had the same problem that port 3306 was not in use but I couldn't start mysql server.
I am first time istalling MySQL Cluster so I followed this guide: https://devops-fu.org/2018/08/13/how-to-install-mysql-ndb-cluster-ubuntu/
It came out that the mysql didn't have access to following folders:
/var/lib/mysql
/var/log/mysql
/var/run/mysql
Maybe I was running installation commands using wrong user account.
I had this problem on my local WampServer (in Windows 10), after hours of try to solve it, I found very simple solution!
Just open Task Manager by keeping "Ctrl" + "Alt" + "Delete" keys, then search for "mysqld.exe" process, right-click on it and click "End Task".
Restart the WampServer and enjoy it!
After more researches and efforts, I decided to fully reinstall MySQL service, because I did not find anything working. Now everything is working fine, but I hope that I will not encounter something hopelessly similar in the future.
I am using PyCharm to connect to my local MySQL database running at localhost port 3306. Here's my JDBC url in the "Data Sources and Drivers" window as shown by PyCharm:
jdbc:mysql://localhost:3306/mydb
When I try to connect or click "Test Connection" I am getting this error in IntelliJ:
Error: Connection to MySQL failed.
Connection to Local MySQL failed.
[08S01] 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.
I can connect to mysql using the command-line client just fine, it's just PyCharm that's not working. What am I doing wrong?
Make sure your MySQL isn't listening on IPv6 address. For some reason IntelliJ/PyCharm has problems when connecting to MySQL running on IPv6 address.
To see what address your MySQL server is listening on, type:
$ ss -ntl|grep 3306
LISTEN 0 80 [::1]:3306 [::]:*
The [::1]:3306 part means it's listening on IPv6 address on localhost.
To change to IPv4, open /etc/mysql/my.cnf and add/set the bind-address parameter in [mysqld] section to 127.0.0.1 instead of localhost:
...
[mysqld]
...
port = 3306
bind-address = 127.0.0.1
...
Then restart mysqld.service and you'll be able to connect via IntelliJ/PyCharm.
I have installed normal mysql with apt-get and now I need to connect it with my lampp server, when is lampp booting it echo "Another MySQL deamon already running" (of course - thats right), but when I open phpmyadmin it gives me an message
2002 - The server is not responding (or the local MySQL server's socket is not correctly configured)
So how I could connect non-lampp mysql with lampp - I suppose that will be with a mysql socket, but I don't know how...
mysql listens for two seperiate types of connections, tcp and unix socket. You can view what your mysqld process listens to with the netstat command:
# netstat -npl | grep mysql
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 2059/mysqld
unix 2 [ ACC ] STREAM LISTENING 6221 2059/mysqld /var/lib/mysql/mysql.sock
Default port for tcp is 3306, and default socket is /var/lib/mysql/mysql.sock (at least it is on RHEL). Local connections (such as the mysql command) tend to use the socket, while remote connections (other servers) need to use the TCP socket.
If your server isn't listening on one, you may have to specify them in your mysqld configuration. These values are controlled in the /etc/my.cnf file:
[mysqld]
socket=/var/lib/mysql/mysql.sock
port=3306
Also, if your TCP socket is listening on localhost only (127.0.0.1) you can specify this in the my.cnf file:
bind_address=0.0.0.0
0.0.0.0 means listen on all local interfaces. If you want it to listen on a specific IP address, specify it.