1

I checked answers such as Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (38) but the answers did not help.

I used service mysqld start to run while generating the log file.

When trying to set up and run mysql, I continue to get the error

Can't connect to local MySQL server through socket '/var/mysql/mysql.sock'

When I check the log file in /var/log/mysql.log I get the InnoDB error mesaage

The error means mysqld does not have the access rights to the directory.

File name ./ibdata1

File operation call: 'open'.

Cannot continue operation

directory /var/mysql does exist. I changed the mode by hand to 777 just to make sure and the run changed it back to 755.

drwxr-xr-x. mysql mysql /var/lib/mysql
-rwxrwxrwx. mysql mysql ibdata1
-rwxrwxrwx. mysql mysql ib_logfile0
-rwxrwxrwx. mysql mysql ib_logfile1
drwxrwxrwx. mysql mysql mysql srwxrwxrwx. mysql mysql shutdown (a DB I am trying to set up)
drwxrwxrwx. mysql mysql test

Other platforms in the system already have mysqld up and running and able to start or stop using service.

Community
  • 1
  • 1
sabbahillel
  • 4,357
  • 1
  • 19
  • 36

1 Answers1

1

When SELINUX is enforcing, all processes are subject to context evaluation.

There are several ways to resolve this issue.

  1. Create selinux policy to allow mysqld to open the necessary files and allow to listen on certain ports. This is not an easy task but there are resources avilable to get this done.

  2. Set selinux to permissive. This will allow mysql to run. This will also generate audit messages from selinux which you can use to generate the policy for mysql.

  3. Set selinux to disabled. This is insecure but acceptable when the database host is in a secure environment.

alvits
  • 6,550
  • 1
  • 28
  • 28