Optimizing MySQL SELECT statements

The core logic of a database application is performed through SQL statements, whether issued directly through an interpreter or submitted behind the scenes through an API. The tuning guidelines of this post will help to speed up all kinds of MySQL applications. The guidelines cover SQL operations that read and write data, the behind-the-scenes overhead … Read more

MySQL Optimization Part 1

Database performance depends on several factors at the database level, such as tables, queries, and configuration settings. These software constructs result in CPU and I/O operations at the hardware level, which you must minimize and make as efficient as possible. As you work on database performance, you start by learning the high-level rules and guidelines … Read more

Recovering Corrupt Tables : MyISAM Table Crash Recovery

If you have to restore MyISAM tables that have become corrupt, try to recover them using REPAIR TABLE  or myisamchk -r That should work in 99.9% of all cases. In this article we will cover to repair/recover MyISAM tables using myisamchk. MyISAM tables have .MYD and .MYI  files for storing data and indexes. You can use … Read more

MySQL Server Logs : Error log and General Query Log

MySQL Server has several logs that can help you find out what activity is taking place. By Default , No Logs are enabled in MySQL. By default, the server writes files for all enabled logs in the data directory. Logs can be flush by Issuing FLUSH LOGS statement. Binary log is flushed when its size … Read more

Creating Views in MySQL : How to create mysql views

Summary: in this tutorial, you will learn how to create views in MySQL by using the CREATE VIEW statement. Introduction to CREATE VIEW statement The syntax of creating a view in MySQL is as follows:   1234 5   CREATE[ALGORITHM = {MERGE  | TEMPTABLE | UNDEFINED}]VIEW [database_name].[view_name]AS [SELECT  statement] Algorithms The algorithm attribute allows you to control which mechanism is used when … Read more

convert time in seconds to HH:MM:SS format in MySQL?

You can use MySQL function SEC_TO_TIME(). Example: SELECT SEC_TO_TIME(2378); Output is: 00:39:38  

Resolved : mysql replica : Relay log read failure: Could not parse relay log event entry.

I’m not sure what the root cause may be. But to recover from this situation, you’d want to instruct MySQL to clear out all the relay-bin-logs beyond the following point Relay_Master_Log_File: mysql-bin.000xxx Exec_Master_Log_Pos: 143983426 by doing the following: mysql> STOP SLAVE; mysql> CHANGE MASTER TO MASTER_LOG_FILE = ‘mysql-bin.000xxx’, MASTER_LOG_POS = 143983426; mysql> START SLAVE;      

Failed to connect to MySQL-asterisk

Files need to check are: /etc/asterisk/res_odbc.conf /etc/odbcinst.ini To resolve this , You have to check the correct configuration of above file. For Example : in —  /etc/odbcinst.ini [MySQL] Description = ODBC for MySQL Driver = /usr/lib/libmyodbc3.so Setup = /usr/lib/libodbcmyS.so FileUsage = 1 or [asterisk-connector] Description = MySQL connection to ‘asterisk’ database Driver = MySQL Database … Read more

Import large csv file using phpMyAdmin

phpmyadmin error

Getting Error while upload large file from phpMyAdmin: Soution: change the memory limit in php.ini file both upload_max_filesize and post_max_size also. Then restart the httpd service (web service)    

MySQL Skip Duplicate Replication Errors : skip replication error

mysql master - slave replication

Normally MySQL replication will stop whenever there is an error running a query on the slave. This happens in order for us to be able to identify the problem and fix it, and keep the data consistent with the mater that has sent the query. You can skip such errors, even if this is not recommended, as … Read more