linux - cannot start mysql server bind socket denied
2014-04
I have been trying to start mysql server but got this error:
Can't start server : Bind on unix socket: Operation not permitted
2013-10-21 13:53:54 25098 [ERROR] Do you already have another mysqld server running on socket: [my-home-dir]/mysql-server/mysql.socket ?
I have searched all pages on google on this topic and have tried all methods, but have no luck.
So here are some more details. I do not have root access on the computer. What I do is install mysql server on my local directory. My my.cnf file looks like this:
[mysqld]
basedir = ~/mysql ## mysql unzipped files
datadir = ~/mysql-server/data
port = 3666
socket = ~/mysql-server/mysql.socket
user = my-ubuntu-user-name
My installation steps are:
- Unzip the source code distribution of mysql 5.6 to ~/mysql
- Create my.cnf as I showed above.
Initialize the server. This step does not show error.
./scripts/mysql_install_db --defaults-file=my.cnf --user=my-ubuntu-user --datadir=~/mysql-server/data --basedir=~/mysql --socket=~/mysql-server/mysql.socket
Start the server
./bin/mysqld --defaults-file=my.cnf
And hence comes the error:
Can't start server : Bind on unix socket: Operation not permitted 2013-10-21 13:53:54 25098 [ERROR] Do you already have another mysqld server running on socket: [my-home-dir]/mysql-server/mysql.socket ?
Also, I have 755 access on all folders related. Any suggestions would be helpful!
---Update
- netstat gives no processes on 3666 running.
- no process called mysql is currently running.
Can you look at the file at /etc/my.cnf and see whether a property like basedir=/var/lib
is there under [mysql.server]
?
If it is there, then try to comment out that property and starting mysql again.
I installed MySQL community 5.1.45 on my Snow Leopard 10.6, using the pkg from their site. I had previously installed a MySQL binary from entropy.ch. In the previous installation, the connections were working fine before I upgrade to Snow Leopard. In Snow Leopard, both the installations are problematic.
Using an app called Sequel Pro, if I connect with the socket operation, it connects properly. However, a standard connection with the same credentials doesn't work. From what I've understood, socket connections happen on the machine itself between processes, whereas normal connections occur over the network/ports, in this case a loopback to my machine, since the server and client are both on the same machine.
My new CakePHP installation isn't being able to connect to the db with the root credentials I provided. Btw, I've been starting the MySQL server using the Preference Pane.
When I tried running mysqld from terminal, it gave me:
100323 1:54:37 [Warning] Can't create test file /usr/local/mysql-5.1.45-osx10.6-x86_64/data/mbp.lower-test 100323 1:54:37 [Warning] Can't create test file /usr/local/mysql-5.1.45-osx10.6-x86_64/data/mbp.lower-test mysqld: Can't change dir to '/usr/local/mysql-5.1.45-osx10.6-x86_64/data/' (Errcode: 13) 100323 1:54:37 [ERROR] Aborting
100323 1:54:37 [Note] mysqld: Shutdown complete
mbp is the name of my machine. How do I fix this so that my webserver can connect to the mysql server?
The permissions in mysql for socket connections are separate from the network connections.
This will allow network connections:
grant all privileges on dbname.* to USERNAME@% identified by 'password'