1./etc/My. CNF Default Configuration
The configuration file is as follows:
[Mysqld]
Datadir =/var/lib/MySQL
Socket =/var/lib/MySQL. Sock
# Default
To using old password format for compatibility with MySQL 3.x
# Clients
(Those using the mysqlclient10 compatibility package ).
Old_passwords = 1
[Mysql. Server]
User = MySQL
Basedir =/var/lib
[Mysqld_safe]
Log-error =/var/log/mysqld. Log
PID-file =/var/run/mysqld. PID
Because the project needs to modify the value of datadir, as follows:
Datadir =/usr/local/project/etc/Data
Start MySql in centos:
[Wzhwho @ local ~] # Service
Mysqld start
Starting mysqld daemon [failed]
2. Check the error log first.
The default path for MySQL Log files installed with RPM is/var/log/mysqld. log.
Mysqld started
InnoDB: operating system error number 13 in a file operation.
InnoDB: the error means mysqld does not have the access rights
InnoDB: the directory.
InnoDB: file name/usr/local/project/etc/data/ibdata1
InnoDB: File Operation call: 'create '.
InnoDB: cannot continue operation.
Mysqld ended
The log shows that the MySQL data file directory does not have the permission, therefore, I need to set the permission and owner for the/usr/local/project/etc/DATA DIRECTORY according to the permission of the/var/lib/MySQL directory.
[Wzhwho @ local ~] # Ll
/Var/lib
Drwxr-X-r-x 1 MySQL
4
Apr 11
2009
MySQL
[Wzhwho @ local ~] # Ll
/Var/lib
[Wzhwho @ local ~] Chown-r MYSQL: MySQL/usr/local/project/etc/Data
[Wzhwho @ local ~] Chmod-r 755/usr/local/project/etc/Data
[Wzhwho @ local ~] # Ll
/Usr/local/project/etc
Drwxr-X-r-x 1 MySQL
4
Apr 11
2009
Data
Then I started MySQL again, but it still failed with the same log information.
3. modify the configuration file/etc/SELinux/config
Finally, I found such a reply in an email from a foreign friend:
If you are using SE Linux, set it
Permissive mode by editing/etc/SELinux/config
And changing
SELinux = enforcing
To SELinux = permissive
This solved all of my problems with
"Operating System error number 13 in a file operation" error
Therefore, if SELinux is the final issue, enter the command LS-Z and you will find the tag on the file or folder. If a file is created when SELinux is opened, even if SELinux is disabled, its permission control still works. You can use chcon to change permissions.
4. MySQL is successfully started.
[Wzhwho @ local ~] # Service
Mysqld start
Starting mysqld daemon [OK]