vsftpd: Error 553 - Could not create file OR login error 530

July 15th, 2010

vsftpd:  Error 553 - Could not create file OR login error 530 

Sample working vsftp.conf file

If that does not solve your problem then try running command-

“setenforce 0″  

Hope that will solve your problem.

Important Question and their Answers for MySQL database

June 10th, 2010


Important Question and their Answers for MySQL database

1.       Quest - How do you convert to a different table type?

Answr - ie. ALTER TABLE

TYPE = InnoDB; OR ALTER TABLE ENGINE InnoDB;

Quest - Which storage engines support transactions in MySQL?

Answr - Berkeley DB and InnoDB.

2.       Quest - How to solve MySQL timeout issue?

Answr - Change/add in /etc/my.cnf[mysqld] : : wait_timeout = 1800 connect_timeout = 10

3.       Quest - Diffrence between MysqlDump and Mysqlhotcopy

Answr -

mysqlhotcopy- A Perl script uses LOCK TABLES, FLUSH TABLES, and cp or scp to make a database backup quickly.

It is the fastest way to make a backup of the database or single tables, but it can be run only on the same machine where the database directories are located.

mysqlhotcopy works only for backing up MyISAM and ARCHIVE tables. It runs on UNIX and NetWare

mysqldump - It can be used to dump a database or a collection of databases for backup or transfer to another SQL server (not necessarily a MySQL server).

The dump typically contains SQL statements to create the table, populate it, or both.

However, mysqldump can also be used to generate files in CSV, other delimited text, or XML format.

4.       Quest - What is longblob data type in MySql?

Answr - Blob is Binary Large Object, used to store the image files or any files as a binary object in the table

5.       Quest - What are the advantages of MyISAM over InnoDB?

Answr - MyISAM is a conservative approach to disk space management.

Each MyISAM table is stored in a separate file, which could be compressed then with myisamchk if needed.

With InnoDB the tables are stored in tablespace, and not much further optimization is possible.

All data except for TEXT and BLOB can occupy 8,000 bytes at most.

No full text indexing is available for InnoDB. The COUNT(*)s execute slower than in MyISAM due to tablespace complexity.

6.       Quest - What are HEAP tables in MySQL?

Answr - HEAP tables are in-memory. They are usually used for high-speed temporary storage.

No TEXT or BLOB fields are allowed within HEAP tables.

We can only use the comparison operators = and <=>.

HEAP tables do not support AUTO_INCREMENT.

Indexes must be NOT NULL.

7.       Quest - How to get the current date?

Answr - Many ways curdate() OR current_date() OR now()

8.       Quest- How to start MySQL on Linux?

Answr-

/etc/init.d/mysql  start OR

service mysqld start/stop in RH

9.       Quest - How to restore deleted records from mysql binary log file?

Answr - mysqlbinlog can be used to retrieve the sql transactions

>mysqlbinlog NAME_OF_BINARY_LOG_FILE > query_text_file.sql

>mysqlbinlog NNAME_OF_BINARY_LOG_FILEs.. >> query_text_file.sql

Fileter out queries that concern deleted records you are looking for (grep can be used here)

>mysql NAME_OF_YOUR_DATABASE < query_text_file.sql

*But always advisable to take backup and restore it from there.

Quest - How to set table and database name in lowercase?

10.   How to set table and database name in lowercase?

Answr- Add/update the /etc/my.cnf file with following-

lower_case_table_names=1

 

 

Script to find log file larger then 1GB /1024MB and delete it

May 29th, 2010

Script to find log file larger then 1GB and delete it

#!/bin/sh
#find / -name ‘*.log’ -size +1024M -print |xargs /bin/rm
find / -name ‘*.log’ -size +1G -print |xargs /bin/rm

This  will try to find files from “/” root directory which is/are greater then 1GB and will delete it.

Schedule this script in the system cronjob/crontab to check and delete it, so that you can sleepwell ;)

MySQL- Store table name in Camel case or Mixed case

April 21st, 2010
MySQL- Store table name in Camel case or Mixed case 

Stop mysql
$/etc/init.d/mysqld stop

Locate and edit my.cnf file

In Linux/Unix OS
$vi /etc/my.cnf

In MS-Windows OS edit
C:\Program Files\MySQL\Mysql Server\my.ini

Add below line at the end of the file
# Store table name in Camel case or Mixed case
lower_case_table_names=0

Stop mysql
$/etc/init.d/mysqld start

Login to mysql and check the global variable

$mysql -u root -p

mysql> show global variables like ‘%case%’;
It should show
lower_case_table_names value as 0

Now test the configuration change you have done by creating a test table inside the test database
mysql> Create database tEsT;

mysql> use tEsT;

mysql> CREATE TABLE TeSt
(First_Name char(20),
Last_Name char(20),
Address char(50),
City char(20),
Country char(25));

Now check/verify the table names case

mysql> desc TeSt;

and you are done!!

How to use nexus MAVEN repository or local maven repository

April 6th, 2010

How to use nexus MAVEN repository or local maven repository 

Check inside your .m2 folder settings.xml, if not present then create one
Based on your build profile define the activeprofile name and provide the nexus/repo server name.

Check out parent repository which has all the sub repository stored in its meta file. (http://YourMavenNexusServer:port/repository/.meta/repository-metadata.xml

Use these information to create your maven settings/configuration.
for example:

How to delete the uninstalled or removed application service from Micorsoft Windows?

January 27th, 2010

How to delete the uninstalled or removed aplication service from Micorsoft Windows?

Stop the service which you want to remove in case it shows still running
run the following commands from command prompt

# net stop {Service Name}
once service is stopped successfully, proceed

# sc delete {Service Name}

sc.exe is located under
C:\WINDOWS\system32\sc.exe in winXP and in win2K

You can download it from here if you are unable to locate it.
Once completed please reboot the system on safer side and you are DONE!

Basic PLSQL with cursor

January 20th, 2010

TABLE test1
Name Null? Type
—————————————– ——– —————————-
A NOT NULL NUMBER(2)
B VARCHAR2(2)
C VARCHAR2(2)
D VARCHAR2(2)
E VARCHAR2(2)

Table test1 having 6 rows
set serverout on;
CREATE OR REPLACE PROCEDURE test5
IS
a number(2);
b VARCHAR2(2);
c VARCHAR2(2);
d VARCHAR2(2);
e VARCHAR2(2);

CURSOR cur IS
SELECT a as a , b as b ,c as c , d as d ,e as e from test1;
BEGIN
OPEN cur;
LOOP
FETCH cur INTO a,b,c,d,e;
EXIT WHEN cur%NOTFOUND;

dbms_output.put_line(a || b || c||d ||e);

END LOOP;
CLOSE CUR;
END;
/
====================================
set serverout on;
exec test5

Install “sar” or “sysstat” for system activity report monitoring

November 21st, 2009

To install sysstat or sar on debian/ubuntu use apt-get to install this
apt-get install sysstat

After this edit the configuration file

vi /etc/default/sysstat
change sadc option from false to true
ENABLED=”true”

/etc/default/sysstat will look like
#
# Default settings for /etc/init.d/sysstat, /etc/cron.d/sysstat
# and /etc/cron.daily/sysstat files
#

# Should sadc collect system activity informations? Valid values
# are “true” and “false”. Please do not put other values, they
# will be overwritten by debconf!
ENABLED=”true”

# Additional options passed to sa1 by /etc/init.d/sysstat
# and /etc/cron.d/sysstat
# By default contains the `-d’ option responsible for
# generating disk statisitcs.
SA1_OPTIONS=”-d”

# Additional options passed to sa2 by /etc/cron.daily/sysstat.
SA2_OPTIONS=”"

Restart the service sysstat service
 /etc/init.d/sysstat restart

Install the crontab
Then run crontab -e and add the following to collect stats:
# Collect measurements at intervals
0 8-18 * * 1-5 /usr/lib/sysstat/sa1 1200 3 &
# Create daily reports and purge old files
5 19 * * 1-5 /usr/lib/sysstat/sa2 -A &

Login message in UNIX

October 12th, 2009

Login message in UNIX-

It is very essential and useful to put the login message in server’s login console to display the login message to avoid any unauthorised access to the system.

edit /etc/motd file

vi  /etc/motd

Place the below text and save it
++++++++++++++++++++++++++++++++++++++++++++++
+ This is a private server!!! All ssh login attempts are logged and      +
+ monitored by our staff. All unauthorized login attempts will be      +
+ investigated and  reported to local authorities.                             +
+ If you have any login problem please contact helpdesk                 +
++++++++++++++++++++++++++++++++++++++++++++++

Open another login console and try to login to the system, you will see this message.

Cheers!

Mysql server gone away

September 15th, 2009

If you get the following error while performing db import or any other activity on your mysql db

Mysql server gone away

You should try increasing  wait_timeout to a greater value.

Most common reason for this error is due to server timing out and closing the connection there by generating following error codes CR_SERVER_LOST , CR_SERVER_GONE_ERROR .