Ssh – Unable to edit/delete/move /etc/the.cnf – Permission denied

my.cnfMySQLssh

I am trying to edit /etc/my.cnf as root user via ssh and I get following error while trying to save it

I ma making changes to my.cnf as I want to tweak some values in my.cnf to meet Magento requirement like changing key_buffer_size= to higher value (128M). I assigned the value 128M to key_buffer_size= and tried to save it and then got an error.

"Error writing /etc/my.cnf: Permission denied"

I cant even restart MySQL successfully.

[root@flourish ~]# service mysqld restart
Stopping mysqld:                                           [  OK  ]
MySQL Daemon failed to start.
Starting mysqld:                                           [FAILED]

I can even delete or replace it with the fresh one. I tried uninstalling MySQL and re-installing but nothing worked. Permission -rw-r–r– and Owner/Group root/root

I hope there is some answer to this problem.

Best Answer

Has the file perhaps been made immutable with chattr? lsattr should tell you:

$ lsattr my.cnf
----i----------- my.cnf

would be the output for an immutable file.