When I restarted a machine today, I found that MySQL could not be restarted. The error "Warning: World-writable config file"/etc/my. cnf "is ignored.
Today, I helped my friend maintain the server. I found mysql could not be shut down by running the database command, and the prompt "Warning: World-writable config file"/etc/my. cnf is ignored, which generally means that permissions can be written globally and can be written by any user. Mysql ignores this configuration file because it is maliciously modified by other users. In this way, mysql cannot be closed.
Next, let's take a look at the entire process.
Restart MySQL
The Code is as follows: |
Copy code |
[Root @ ttlsa ~] # Service mysqld stop Warning: World-writable config file '/etc/my. cnf' is ignored Warning: World-writable config file '/etc/my. cnf' is ignored MySQL manager or server PID file cocould not be found! [FAILED] |
Mysql cannot be stopped.
View Permissions Of my. cnf
The Code is as follows: |
Copy code |
[Root @ ttlsa ~] # Ls-l/etc/my. cnf -Rwxrwxrwx 1 root 4878 Jul 30 :31/etc/my. cnf |
Permission 777. Any user can change my. cnf, which poses a major security risk.
Fix MySQL Problems
The Code is as follows: |
Copy code |
[Root @ ttlsa ~] # Chmod 644/etc/my. cnf |
My. cnf is set to allow users to read and write, while other users cannot write.
Disable MySQL
The Code is as follows: |
Copy code |
[Root @ ttlsa ~] # Service mysqld stop Shutting down MySQL... [OK]
|
MySQL is closed successfully. The problem is very simple.