> This is basically for installation of VPS with centOS 5 ( Minimal Install )
> To install MySQL in the VPS Server node :
vzyum 103 install mysql-server -y
> Create a location : /vz/shared
> Mount as /shared in every VPS using mount script ( Permissions – 755 )
>
Content of /etc/vz/conf/101.mount (web node)
Content of /etc/vz/conf/102.mount (web node)
Content of /etc/vz/conf/103.mount (database node)
#!/bin/bash
# Mount script to bind-mount /var/… into a VPS
[ -f /etc/vz/vz.conf ] || exit 1
[ -f $VE_CONFFILE ] || exit 1
. /etc/vz/vz.conf
. $VE_CONFFILE
echo -n “Mounting shared directory inside $VEID…”
if [[ -d /vz/shared ]]
then
mkdir -p $VE_ROOT/shared
mount -n –bind /vz/shared $VE_ROOT/shared
echo ” done”
else
echo ” failed”
fi
> Change MySQL Socket location from /var/lib/mysql/mysql.sock to /shared/mysql/mysql.sock
Content of /vz/private/101/etc/my.cnf
Content of /vz/private/102/etc/my.cnf
Content of /vz/private/103/etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
#socket=/var/lib/mysql/mysql.sock
socket=/shared/mysql/mysql.sock
[mysql.server]
user=mysql
basedir=/var/lib
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[client]
socket=/shared/mysql/mysql.sock
> Also, make the changes to php.ini other applications that use MySQL
> Also, make sure to change the permissions so that sockets can be accessed by other processes
[root@vz103 ~]# chmod o+rx /shared/mysql
[root@vz103 ~]# ls -l /shared/
total 8
drwxr-xr-x 2 mysql mysql 4096 Apr 5 15:44 mysql
drwxr-xr-x 2 root root 4096 Apr 3 15:03 tmp