Steps I use to install MySQL to a different directory. The truth is I just use the rpm and let it install in the default /var/lib/mysql on Redhat and then I do the following to move it to another directory.
After the install I setup my my.cnf file and then start MySQL. I don't think it is necessary to start it, but I do so that the ib files can be created. I then stop MySQL. I cd to /var/lib and move the mysql directory to wherever I want. In my case I move it to my /data directory which is on a different filesystem.
So I issued this command mv mysql /data
Then I create a symbolic link to my new mysql location by using this command:
ln -s /data/mysql mysql
Now under /var/lib/ I have a symbolic link that points to /data/mysql. If I cd to /var/lib/mysql I will be in /data/mysql.
One reason I do this is I don't like to have data in my root partition in case I fill it up. Also, in my setup I don't have enough room in my root partition to host mysql.
After making this change I started to get this error:
starting mysql.the server quit without updating pid file failed. I've seen this error before and it is usually a permission issue. I checked my permissions and the permissions were fine.
The problem is selinux the iptables or firewall.
To check run this command:
semodule -l
semodule -l
Check and see if mysql is in the list?
Now temporarily disable selinux with this command:
echo > 0 /selinux/enforce
or
service iptables stop
Now try to start MySQL. Did it start? Mine Did.
Now you know the problem is with selinux. You have a few chooses:
1. you can disable selinux by adding SELINUX=disabled in /etc/selinux/config. The lease secure, but fastest fix.
2. You can disable the mysql module in selinux. To disable mysql run this command:
semodule -v -d mysql or semodule --disable=mysql
To re-enable module run this command:
semodule -v -e mysql or semodule --enable=mysql
The "-v" is verbose and is not necessary.
3. You can keep it enabled, but follow the information in this link:
No comments:
Post a Comment