How to install (and run) postgresql on a machine that has mysql? - mysql

I got the package postgresql-8.4.9.tar.bz2 on the postgresql website and installed it following the instructions on the file INSTALL. But when we try to run it, it doesn't work and throws this error:
/usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data
LOG: could not bind IPv6 socket: Address already in use
HINT: Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
LOG: could not bind IPv4 socket: Address already in use
HINT: Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
WARNING: could not create listen socket for "localhost"
FATAL: could not create any TCP/IP sockets
I don't know, maybe it's because of some conflict with mysql. Does anybody know what's going on?
Thanks in advance!

It appears that another process is listening on port 5432. Try running the following command:
sudo netstat -tulpn | grep 5432

Related

How to fix: MySQL can not start: Error "another mysqld server running on port: 3306?" - checked port and it is FREE

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.

mysql defaults to 3306 even if different port is defined in my.cnf

OS: Linux
I'm trying to start mysql on port 1561 on the localhost using this command:
/appl/mysql/5.6.14/bin/mysqld_safe
--defaults-file=/appl/mysql/5.6.14/my.cnf --ledir=/appl/mysql/5.6.14/bin/ --socket=/tmp/mysql.sock
I already have port=1561 defined on my.cnf but somehow, the mysql service defaulted to 3306. Per checking on netstat command, mysql listens on port 3306 instead of 1561.
We managed to fix this by using below command, but I want to know the chances of the above scenario happening again and how we can avoid it.
command used to fix:
./mysql.server stop
./mysql.server start

How can one unbind port 3306?

I am new to google cloud but was just able to deploy the test Django app that google provided in their documentation. This process included downloading the cloud_sql_proxy and running the following in the terminal (MacOS):
./cloud_sql_proxy -instances="my-instance-274702:us-central1:fms"=tcp:3306
This command starts running the proxy in order to connect locally to the DB in the cloud. Everything was working fine until I terminated the proxy with ctrl + C. When I ran the following command to start the proxy again I got the following error:
ludovico#Ludovicos-MacBook-Pro django % ./cloud_sql_proxy -instances="my-instance-274702:us-central1:fms"=tcp:3306
2020/04/18 23:38:10 Rlimits for file descriptors set to {&{8500 9223372036854775807}}
2020/04/18 23:38:12 listen tcp 127.0.0.1:3306: bind: address already in use
I got this error the first time I did this but I fixed it by shutting down the MySQL server that was running on port 3306. Now however, port 3306 is already bound to the cloud_sql_proxy and so it is throwing an error and is unable to start the proxy. If I run the same command with port 3307 it works just fine:
./cloud_sql_proxy -instances="my-instance-274702:us-central1:fms"=tcp:3307
But Django does not look for port 3307 it looks for port 3306.
Is it possible to unbind port 3306? Better yet, is there a command to start running the proxy instead of binding and unbinding port 3306 each time?
use
ss -lptn
the sport command to show which port is bind to which process.
Then kill the process running on 3306 by
kill -9 {process_id}
this will unbind your busy port 3306. Then you can run process on 3306.

Do you already have another mysqld server running on port: 3306 Ubuntu

I am new to Ubuntu and I am trying to run mysql using xampp. Earlier xampp was run successfully and able to run mysql as well. But suddenly when I trying to start it was stopping and it will display an error message on log saying "do you already have another mysqld server running on port: 3306". So I tried to kill the running process of mysql using following command but even that process was get killed, there will be another new process of mysql running when I rerun the following command.
pidof mysqld
sudo kill -9 <pid>
I tried to kill all the processes running on port 3306 as well. But same result happened. Where I was get wrong and how to resolve this?
sudo lsof -i TCP:3306' andsudo kill ` commands worked for me.
you can try "netstat -anltp" to find See if 3306 port still being used

Website connection error related with MySQL 4.1.24

I get an error on my website (MySQL with TCP/IP connection)
Can't connect to local MySQL server
It sounds easy, perhaps, but not so easy to solve as would seem. At first i verified that mysqld process is running. Then connected to SSH server and started /etc/init.d/mysqld restart, but nothing has changed. Also i checked is the server running, using telnet your-host-name tcp-ip-port-number, just in case, but MySQL does not work on this port and shows another error: telnet: Unable to connect to remote host: Connection refused
The last i have tried is to run mysql with the skip-networking option, and it did not help as well as other attempts above. Any suggestions would be very appreciated.
This error normally means that MySQL is not running on the system or that you are using a wrong TCP/IP port number while trying to connect to the mysqld server.
Try to connect to the mysqld daemon on the local machine and check by mysqladmin variables, which TCP/IP port is configured to use mysqld (variable port).
Perhaps you are running MySQL-server with no corresponding privileges for the directory holding the socket file. In this case, either change the privilege for the directory or restart mysqld
Also this discussion might be interesting for you: http://community.office365.com/en-us/f/172/p/266451/815406.aspx
Unfortunately, i am not a pro and my advices can help not much, but that all what i found about your issue
This sounds like you are being blocked by the firewall on the server. You can disable the firewall for a quick test:
service iptables stop
service iptables start
This article will show you how to apply rules to the firewall to allow mysql access.
http://www.cyberciti.biz/tips/linux-iptables-18-allow-mysql-server-incoming-request.html
If you have SELinux, you have another set of problems which I can't help you with.
Sounds to me permission issue.
Does it run on the local machine?
If yes, then it might me possible it isn't allowed to listen any port(security purposes: mostly on a linux based server). Otherwise, Network user might not have permission granted to access mysql over internet.
As you say, if it's a website, I would never allow user access mysql directly but only the server shall: possible security breach otherwise.(you don't want your database to be dropped, do you?)
Well still, proper answer to you question resides here: http://dev.mysql.com/doc/refman/5.1/en/grant.html
and this might help:
Host 'xxx.xx.xxx.xxx' is not allowed to connect to this MySQL server
Firstly, you should verify that MySQL is actually running by checking your processlist. On linux you could do that like this, note that you should see both mysqld_safe and then mysqld as two separate processes.
sudo ps auxwww|grep -i mysqld
If it is not running, I would check the MySQL error log for clues as to why it is not starting.
If you then verify that it is running, we can check to see what ports or unix sockets it is listening on like so. If this doesn't work, get the process ID of mysqld (not mysqld_safe) and try search for that with grep instead of 'mysql'
sudo netstat -anp|grep -i mysql
You'll obviously want to restart without skip-networking to see a TCP socket appear.
Based on the output of that, you should see both a unix socket and a tcp socket. Also check the address in the fourth column for the TCP socket, it will likely say either 127.0.0.1:3306 or 0.0.0.0:3306. The former means that you can only connect via localhost (127.0.0.1) and the latter means the connection will work on any IP address.
If you've gone through all of that and are still not sure why it is working, you could post the processlist and netstat outputs for further review, along with the exact settings you are using to try and connect to MySQL and indicate whether you are connecting from the same server (i.e. locally) or from another server over the network.
See also:
http://dev.mysql.com/doc/refman/5.6/en/can-not-connect-to-server.html