Posted on September 25th, 2006 by Jason.
Categories: Linux, web Hosting, MySQL.
Hello,
Use this guide at your own risk! Fdisk is a very powerful tool and can easily screw up a server if you are not careful. This guide was designed around a server that has SCSI disks and it is mounted in the secondary positions, sdb. If you have a ide drive it would be hdb.
This guide is pretty vague, that was done on purpose. It is very hard to do something like this if you are not familiar with linux and fdisk. I do not want people screwing around with this if they are not confident in what they are doing. I am just trying to stop people from getting mad at me. Anyways below is the guide it is to be used totaly at your own risk but I can say that if done correctly it will work just fine.
That all say here is the actual guide.
fdisk /dev/sdb
The first step is to delete all of the old partitions. If you have a lot of partitions you are going to have to keep trying to go to higher numbers. Once you have deleted all partitions it will say there are no paritions.
d –delete
1 — partition 1
d
2
d
3
d
4
Create a new partition as /dev/sdb1
n — new
p — primary
1 — first partition
– use default cylinder value, which is the first available
+5000M — make ~ a 5Gb partition which I think is a good size for a mysql database directory
Create a /tmp partition as /dev/sdb2 that will be ~1Gb
n
p
2
+1000M
Create a backup partition as /dev/sdb3 which will take up whatever extra space the disk has.
n
p
3
- uses the rest of the disk
w — writes out and saves
Now we are going to format the filesystem as ext3 which is what most servers run with and is in my opinion the best choice.
mkfs -t ext3 /dev/sdb1
mkfs -t ext3 /dev/sdb2
mkfs -t ext3 /dev/sdb3
Now add the following in /etc/fstab so that they are mounted automatically on boot.
/dev/sdb1 /var/lib/mysql ext3 defaults,usrquota 1 1
/dev/sdb2 /tmp ex3 noexec,nosuid,rw 0 0
/dev/sdb3 /backup ext3 defaults 0 0
service mysql stop; killall -9 mysqld
Now copy the old dir so we can copy
mv /tmp /tmp_old; mkdir /tmp
mv /var/lib/mysql /var/lib/mysql_old; mkdir /var/lib/mysql
mount /var/lib/mysql
mount /tmp
cp -R /var/lib/mysql_old/* /var/lib/mysql/
chmod 755 /var/lib/mysql
chown mysql:mysql -R /var/lib/mysql
cp -R /tmp_old/* /tmp/
chmod 0777 /tmp
service mysql start
Hopefully it should all be working fine.
Posted on September 22nd, 2006 by Admin.
Categories: Cpanel Hosting, MySQL.
Greetings Guys ,
To set the mysql database backup through cronjob …
* * * * * /usr/bin/mysqldump -u dbusername dbname -p password > /home/uesrname/dbname.sql
Where you can setup the time / interval when you need backup
Cheers
Kyle
Posted on September 18th, 2006 by Admin.
Categories: Cpanel Hosting, MySQL.
Greetings Guys ,
Changing MySQL root passwd :–
# /etc/rc.d/init.d/mysqld stop
# /usr/bin/safe_mysqld –skip-grant-tables
# mysql -u root
mysql> use mysql;
mysql> update user set Password = PASSWORD(’98f738d’) where User =’root’;
mysql> exit
# /etc/rc.d/init.d/mysqld stop #yes this worked
# /etc/rc.d/init.d/mysqld start
Cheers ,
Admin