Nutshell

Follow by Email

 

Compiling new kernel is simple now , with steps

Thursday

Hi All,

Wanted to share the simple procedure of upgrading your kernel.

1. Download and extract the source code of kernel from kernel.org into /usr/src
2. From the directory compile by issuing below commands
- make menuconfig
- make 
- make modules_install && install
3. Reboot the linux server
4. To verify that we are using the kernel we complied by issuing the command : " uname -a "

Hope this has helped.
Also if you done it another method or facing any issues plz feel free to share & discuss here

Moving Mysql directory to an another Location

Friday


Overview
What is the need with moving database directory ?  Let's understand this why or when we need to move database directory from one location to another one .

The database is getting grow every moment it will grow out of space. when database size increases out of memory then database service will stop working. It will result into website or application will be down. In such scenario, we need to provide or add disk to a database. when you come to such situation then the best solution is to move our database directory to other location where it gets the more storage to save the extra amount of data.

In this scenario, we need to provide disk to the database. when you come to such situation then the best solution is to move mysql database directory to other location where it gets the more storage to save the extra amount of data.
This masterpiece  will guide you to change mysql database to another location.

By default the databases stored under the "/var/lib/mysql" directory. This basically comes under root partition. We are not consuming a big space for the root partition.

To change or move mysql location we need to consume below marvellous tasks. But before doing this steps make confirm we have taken backup copy of our complete databases.



You need to perform tasks one-by-one

Backup of Mysql Database
Copy Mysql directory to another location
 Check Permission & Size of MySQL files
 Change directory in my.cnf file
 Restart MySQL service
This article demonstrates the details on how to perform above mentioned steps to change Mysql data directory to a different location.

1. Backup of Mysql Database
Whenever you are performing any task on production server make sure you have a backup of all the data.

Here we first took the backup of MySQL all available database in a single .sql file using mysqldump command generally.

mysqldump -u username -p --all-databases > alldatabase.sql
Read more about the useful MySQL commands from below link.

Useful MySql Commands Every SysAdmin to Know

2. Copy MySQL directory to another directory
Once backup completed, copy mysql directory "/var/lib/mysql" to other location where you have enough space to store larger database. Here I have move "mysql" directory to /data directory.

Use below copy command,

cp -r /var/lib/mysql  /data  [It will take time to copy complete MySQL directory]
3. check permission & Size of directory
After copying the mysql directory to /data. check the /data/mysql directory and file permissions are exactly same as "/var/lib/mysql" directory.

$ ls -l /var/lib/mysql
-rw-rw---- 1 mysql mysql 15344861184 Aug 29 18:36 ibdata1
-rw-rw---- 1 mysql mysql 5242880 Sep 14 12:16 ib_logfile0
-rw-rw---- 1 mysql mysql 5242880 Sep 14 12:16 ib_logfile1
-drwx------ 2 mysql mysql 4096 Dec 31 2015 mysql
-srwxrwxrwx 1 mysql mysql 0 Sep 17 19:03 mysql.sock

$ du -sh /var/lib/mysql
- 20GB

$ ls -l /data/mysql
-rw-rw---- 1 mysql mysql 15344861184 Aug 29 18:36 ibdata1
-rw-rw---- 1 mysql mysql 5242880 Sep 14 12:16 ib_logfile0
-rw-rw---- 1 mysql mysql 5242880 Sep 14 12:16 ib_logfile1
-drwx------ 2 mysql mysql 4096 Dec 31 2015 mysql
-srwxrwxrwx 1 mysql mysql 0 Sep 17 19:03 mysql.sock

$ du -sh /data/mysql
- 20GB
4. Change directory path in my.cnf file.
my.cnf file is main configuration file of mysql. This file resides under "/etc/mysql" directory. Open "my.cnf" file and replace "datadir" path with newer mysql directory path.

vim /etc/mysql/my.cnf
 datadir=/data/mysql
5. Restart Mysql Service
once the configuration changes done then restart or start|stop mysql service which will help to reflect the configuration changes.

$ /etc/init.d/mysql stop
$ /etc/init.d/mysql start
6. Test MySQL
After the restart, the MySQL service, check with creating a database in MySQL. You are new database will be created under the /data/mysql directory. It means mysql directory successfully moved to the new directory.

I hope you like this masterpiece if you find any issues in moving MySQL directory then you must do comment your queries or issues on comment section, till then stay tuned to indianhostinginfo.com for more such valuables masterpieces .

Total Pageviews