Installing Mysql on Windows

Written by Pravin on October 20, 2008 – 4:50 am -

This installation is for Mysql 4 on Windows. Download Mysql 4 from

Run the MSI file and use the following settings

* Typical Setup
* Skip Sign-Up
* make sure “Configure the MySQL Server now” is checked
* “Detailed Configuration”
* “Developer Machine”
* “Multifunctional Database”
* “InnoDB Tablespace Settings” – leave everything default
* “Decision Support (DSS)/OLAP”
* make sure “Enable TCP/IP Networking” is checked and leave the port number at 3306 (at this point, if you have a firewall, it will usually try to access itself on the localhost)
* “Standard Character Set”
* check “Install As Windows Service”
* enter your root password and I would recommend leaving “Enable root access from remote machines” unchecked
* then hit “execute” and it’ll install and set it up.

Tags: , , , , , , , ,
Posted in Dedicated Server Hosting | No Comments »

How to converting MYSQL table from InnoDB engine to MyISAM

Written by Mangesh on October 16, 2008 – 10:36 pm -

How to converting MYSQL table from InnoDB engine to MyISAM

I have problem of table repair in InnoDB so I need to convert InnoDB to the engine MyISAM.

I converted a MySQL table’s InnoDB to the engine MyISAM.

The code I found for conversion:


You can replace MYISAM engine to InnoDB, ISAM, HEAP and etc.

Tags: , ,
Posted in Dedicated Server Hosting, linux, Linux VPS Hosting, Plesk For Linux, VPS hosting, Windows VPS | No Comments »

Optimize MySQL database

Written by AlanV on October 10, 2008 – 5:18 am -

Optimization is an integral part of database administration. When database is heavily used having too many records and hence there are too many inserts/deletes or retrievals from the database in that case MySQL uses most of system resources.

There are two many options you have to optimize the query or MySQL databases.

Those options are illustrated in this article.

If querying is taking lot of time, and database connections and backlogs are growing, then site performance as well as server performance goes down causing high load sometimes or database crashed which indicate that it is time to optimize your database.

mysqladminpr command is used to check which mysql queries are responsible for heavy system resources.

You can modify MySQL configuration file (my.cnf) to log slow queries. It will check the slow running queries and the possible causes.

This could be related to indexes like no index or improper index for database columns. Here is an attempt to describe which commands and concepts we can use to optimize MySQL so that it will improve the performance.

Step 1:

Use of indexes

Using indexes makes the query faster in the same way as an index in a book helps in looking for a particular word.

To know how and which indexes are used in a given query, use EXPLAIN command as a prefix to select query.

EXPLAIN SELECT employee_code FROM emp WHERE dept = ‘IT’;

This command returns following information:

Table – Which table(s) are used in the query
Type – JOIN type. Values can be system, const, eq_ref, ref, range, index, all
Possible Keys – All keys which can be used for indexes
Key – The key actually used for index
Key Length – Shorter keys are better
Ref – Other Columns used with key to get the results
Rows – Number of rows from where data will come
Extra – Extra information. Some possible values can be using index, using where, using temporary, using filesort

You should reconsider your table structure if Possible Keys contain NULL value.
A NULL value in Key field indicates no index is being used. Using no indexes will deter the performance if there are too many records in the table because, for any query, all the records will be searched for the given condition.

Use ALTER command to add index as given below:

ALTER TABLE table_name ADD INDEX (column_name);

You can do indexing on multiple columns using:

ALTER TABLE table_name ADD INDEX (column_name1,..,column_nameN);

MySQL uses leftmost prefixing, so automatically indexes will be added for column_name1, (column_name1,column_name2),…(column_name1,..,column_NameN-1). This is quite helpful in situations like searching based on surname so an index on (surname, firstname, middlename) will automatically add multiple indexes used in faster querying.

Points to remember:

  • Choose the column(s) for indexing very carefully.
  • Indexed fields should be used for searching and query should be re-framed if any calculation is performed on indexed fields.
  • Index itself takes storage space.
  • Each operation on database requires updating index as well.
  • A smaller Key Length reported by EXPLAIN command is better. Smaller key length means lesser storage space is required by index file and also that time to search in index is less. For this, indexes can be set on part of columns. For example, INDEX(col1(10),col2(20)). Again, you have to judiciously decide what length of columns to be used for indexing.

Step 2:

Using ANALYZE command

ANALYZE command is used to generate key distribution for the table to be used by MySQL query optimizer to decide which indexes are best to use in a query.

ANALYZE TABLE table_name;

Step 3:

Using OPTIMIZE command

If there are too many inserts/deletes in a table then OPTIMIZE command must be frequently used to optimize disk head movement during retrieval. This is particularly useful if variable size columns are used like varchar, text, blob etc. OPTIMIZE command does defragmentation of the fragmentation caused by variable length fields like VARCHAR.

OPTIMIZE TABLE table_name;

Step 4:

Using special functions for loading data

For loading data from a file into a database table, using LOAD DATA INFILE is much faster than reading data from file iteratively and using INSERT command. The syntax for this command is:

LOAD DATA INFILE ‘impdata.dat’ INTO TABLE table_name (col1,col2,…,colM) FIELDS TERMINATED BY ‘|’”);

Step 5:

Setting PRIORITY of commands

If there are more queries than data insertions, you may lower priority of INSERT command using:


If client is not interested in results of INSERT, then it can be immediately freed using following command:


This makes the system faster by batching insertions.

Step 6:


DELETE command use to deletes row by row, while TRUNCATE use to deletes all rows at once. So, if you are not interested in number of rows deleted from a table as result of DELETE command, then use TRUNCATE with following syntax:

TRUNCATE TABLE table_name;

Step 7:

Lowering permission checking overhead

Simpler permissions reduce permission checking overhead. Use GRANT command to set the permissions. General syntax for GRANT is:

GRANT priv_type [(column_list)]

[, priv_type [(column_list)]] …

ON [object_type]



| *.*

| db_name.*

| db_name.tbl_name

| tbl_name

| db_name.routine_name


TO user [IDENTIFIED BY [PASSWORD] ‘password’]

For example:

GRANT SELECT,UPDATE ON emp_sal TO hr@localhost IDENTIFIED BY ’password’;

If user account ‘hr’ is not there, then it will be created on localhost (although user can access data from any workstation) and password ‘password’ will be assigned to it.

Step 8:

Use BENCHMARK() function

To know how much a given MySQL function or expression is taking time, use MySQL built-in function:

BENCHMARK(loop_count, expression)

It always returns 0 but also prints time taken by the expression.

Step 9:

Synchrozing data types

If columns in tables contain identical information, then make their data types also same so that joins can be performed faster.

Step 10:

Database optimization is not one time job. You have to optimize it every after 2-3 months.

Tags: , , , ,
Posted in Dedicated Server Hosting, linux, Linux VPS Hosting, Plesk For Linux, VPS hosting, Windows VPS | No Comments »

How you can take database backups on linux

Written by AlanV on September 20, 2008 – 11:27 am -

MySQL is most popular and common database used in linux, unix and all
cPanel, Plesk servers ,
PostgreSQL is also used but it is not as widely use as MySQL

A. MySQL database backup

mysqldump is used to take the backup of MySQL databases

# mysqldump database_name > backupfile.sql
This will generate the backup of MySQL databases in .sql file

To restore dumps you can use mysql command

# mysql database_name < backupfile.sql

B. PostgreSQLdatabase backup

It is easy method to take PostgreSQL database backup

# pg_dump databaseame > databasename.pgdump

Restore the database from the dump

# cat databasename.pgdump | psql databasename

If database is large then you can use gzip to redeuce size if backup file

# pg_dump databasename | gzip > databasename.dump.gz

Then restore the dunp into database

gunzip -c databasename.dump.gz | psql databasename

Tags: , , , , ,
Posted in Dedicated Server Hosting, Linux VPS Hosting | No Comments »

Migrating Cpanel Servers

Written by Swapnil on September 17, 2008 – 1:52 pm -

Moving all the accounts between two Servers that host the same control panel is usually not a very difficult process.

You need to move all domains from the present server to the new server. At the same time, you need the whole move done perfectly and with zero downtime for all domains. In addition, you need to move even your nameservers between two different datacenters. Its pretty complicated.
Read more »

Tags: , , , , , , , , , , , , , ,
Posted in Dedicated Server Hosting, Linux VPS Hosting | No Comments »

  • Subscribe Me

  • Tag Cloud

  • Archives