MySQL cannot start except manually as root
Hello,
I'm new to Red Hat and Linux in general. I have setup the Red Hat system and installed MySQL through the Add / Remove Program. I have RHEL 5.4. When MySQL is being started manually it is being started as root. However, when MySQL is being started using the services command it is started as the user MySQL and it doesn't work. How can I start MySQL service as root? Or is there another way to fix that issue. Let me know if you need more information (giving details on how to get it would be nice too). Thank you, Yael |
In default, init script in /etc/init.d calls mysqld_safe run as root and mysqld_safe fork mysqld - a child process run as mysql user:
Code:
root 2657 1 0 Jun13 ? 00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --socket=/var/lib/mysql/mysql.sock --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --user=mysql |
make sure your datadir (normally /var/lib/mysql) and everything under it are owned by mysql. do a chown -R mysql.mysql /var/lib/mysql (or whatever your datadir is) to be sure, and then retry to start the service.
|
well for security reasons; mysqld process should never be run as root since some internal commands can wright directly to the file system and it inherits the permissions of who ever started it. In short: started by root = mysql has access to the whole system.
|
Quanta, here is the result when I start mysql manualy (I'm already in root):
Code:
[amrita@AMRStag ~]$ su - chickenjoy, thanks for the info. The /var/lib/mysql is pointed to a LUN which is already mounted. Do I need to setup something in /etc/fstab to give everyone read and write access to that LUN, could that be the problem? Let me know if you need anything else. Thanks, Yael |
Run the commands below and give us the output:
Code:
# ls -l /var/lib/mysql |
Most likely LUN is mounted with read-only permissions. Or there was problems with permissions and chown/chmod need to be applied upper in the tree with recursive option. Nice catch @quanta.
|
LUN permission could be the issue, what am I suppose to add in my fstab?
Here is what Quanta requested Code:
[root@AMRStag ~]# ls -l /var/lib/mysql |
Last row of fstab might need extra options, bout mount says its ReadWrite, so I do not think is fstab option (someone should confirm this).
Mount says /dev/sde1 is mounted to /var/lib/mysql. Is that NetApp LUN? Fstab reads that both "/usr/local" and "/var/lib/mysql" are on separate partitions, but mount does not see any "/usr/local". That should not be happening, right? Do you have ANY files or folders on that NetApp partition? Could it be it's broken/not formated or similar? Can you check NetApp settings? For now try dissabling both NetApp partitions and allow both "/usr/local" and "/var/lib/mysql" to be on root partition, like before you started. Then try mounting those LUN's on separate, irelevant, mount points, just to test them before use. Then when you are pleased with results change mount points. |
I haven't had any experience with NetApp LUN but it seems you have a problem with your device: http://serverfault.com/questions/124...only-from-a-di
|
I have setup other Red Hat like this with that problem. The only thing different is the developer went and changed the mount to different folders and setup MySQL.
I'm going to have them try one of my other Red Hat (I have one setup exactly the same) and we'll see if that works better or not. |
I restarted the server just to see how it worked redid those commands and here is my result
Code:
<<< Log from 192.168.21.222 started August 18, 2010, 07:30:18 >>> |
All times are GMT -5. The time now is 08:22 AM. |