Pages

Tuesday, July 5, 2011

MYSQL : Loading data into MySQL in quicker way


MYSQL : Loading data into MySQL in quicker way
Disabling key checks can help speed up the import.
SET UNIQUE_CHECKS=0;
SET FOREIGN_KEY_CHECKS=0;
Whenever we load data into a MySQL database the following settings can help speed up the import.
innodb_flush_log_at_trx_commit = 0
innodb_support_xa = 0
skip-innodb_doublewrite
If the server doesn’t have replication configured and if the log-bin is enabled,  disable it using SET SQL_LOG_BIN=0 or manually comment log-bin parameter in my.cnf. Similiarly we can disable other logs will also help. These parameters help in reducing frequent syncs to disk…
Cheers!!!!

MYSQL : mysqld server - SOCKET ERROR


MYSQL : mysqld server - SOCKET ERROR


ERROR 2002 (HY000): Can’t connect to local MySQL server through socket '/usr/local/mysql/mysql.sock'


Following are the scenarios for getting socket error - 


1. Check whether mysqld server is running or not, using the below command
ps -ef | grep mysql


If mysqld is running, then check the socket path in the configuration file ( ie.. my.cnf )and give the correct path when connecting.


2. Check the file permission of that socket file. If the file doesn’t have mysql permission, just change permission to mysql using the below command.


chown mysql:mysql /usr/local/mysql/mysql.sock


3. If the socket file is missing then you have to restart your mysqld server. Its automatically create new socket...


Cheers!!!