How to retrieve system level logs from a Windows or Linux machine

This document will let you know how to retrieve system level logs from a Windows or Linux machine.

Windows servers have four types of logfiles by default: System, Security, Application and Internet Explorer, located here:

“Start” –>”Settings” –>”ControlPanel” –> “Administrative Tools” –> “Event Viewer”

Each logfile must be saved individually.

Right-click on the log you wish to save, choose “Save log file as…”. In case you are using RDP- to get into the your server, then you might be able to copy and paste the file(s) to your desktop.

Most Linux logfiles are located in /var/log. There can be many files and directories in this location, so your best choice here is to either you need to find exactly which logfiles you need and get only those files and directories or get a copy of the entire /var/log directory.

Leave a Comment

MYSQL Error #2002

While accessing PhpMyAdmin getting the following error.

MYSQL Error #2002 – showing server is not responding or local MySQL server’s socket is not correctly configured.

Reason :-

The mysql socket file is missing from the /tmp directory

Fix :-

1. Create a symbolic link from the original mysql socket file to /tmp

[root@test ~]# ln -s /var/lib/mysql/mysql.sock /tmp

OR

2. Restart MySQL service from WHM

WHM Login >> Main >> Restart Services >>SQL Server (MySQL)

OR

3. Edit the PhpMyAdmin configuration file to use the original MySQL socket file.

# vi /usr/local/cpanel/base/3rdparty/phpMyAdmin/config.inc.php

Make sure, the correct mysql socket file is mentioned there.
———————-
$cfg['Servers'][$i]['socket'] = ‘/var/lib/mysql/mysql.sock’;
$cfg['Servers'][$i]['connect_type'] = ’socket’;

Leave a Comment

MySQL Error Codes- Part II

MySQL Error Codes, continued from earlier post:

Error: 1026 SQLSTATE: HY000 ER_ERROR_ON_WRITE Message: Error writing file ‘%s’ errno: %d
Error: 1027 SQLSTATE: HY000 ER_FILE_USED Message: ‘%s’ is locked against change
Error: 1028 SQLSTATE: HY000 ER_FILSORT_ABORT Message: Sort aborted
Error: 1029 SQLSTATE: HY000 ER_FORM_NOT_FOUND Message: View ‘%s’ doesn’t exist for ‘%s’
Error: 1030 SQLSTATE: HY000 ER_GET_ERRNO Message: Got error %d from storage engine
Error: 1031 SQLSTATE: HY000 ER_ILLEGAL_HA Message: Table storage engine for ‘%s’ doesn’t have this option
Error: 1032 SQLSTATE: HY000 ER_KEY_NOT_FOUND Message: Can’t find record in ‘%s’
Error: 1033 SQLSTATE: HY000 ER_NOT_FORM_FILE Message: Incorrect information in file: ‘%s’
Error: 1034 SQLSTATE: HY000 ER_NOT_KEYFILE Message: Incorrect key file for table ‘%s’; try to repair it
Error: 1035 SQLSTATE: HY000 ER_OLD_KEYFILE Message: Old key file for table ‘%s’; repair it!
Error: 1036 SQLSTATE: HY000 ER_OPEN_AS_READONLY Message: Table ‘%s’ is read only
Error: 1037 SQLSTATE: HY001 ER_OUTOFMEMORY Message: Out of memory; restart server and try again needed %d bytes
Error: 1038 SQLSTATE: HY001 ER_OUT_OF_SORTMEMORY Message: Out of sort memory; increase server sort buffer size
Error: 1039 SQLSTATE: HY000 ER_UNEXPECTED_EOF Message: Unexpected EOF found when reading file ‘%s’ errno: %d
Error: 1040 SQLSTATE: 08004 ER_CON_COUNT_ERROR Message: Too many connections
Error: 1041 SQLSTATE: HY000 ER_OUT_OF_RESOURCES Message: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use ‘ulimit’ to allow mysqld to use more memory or you can add more swap space
Error: 1042 SQLSTATE: 08S01 ER_BAD_HOST_ERROR Message: Can’t get hostname for your address
Error: 1043 SQLSTATE: 08S01 ER_HANDSHAKE_ERROR Message: Bad handshake
Error: 1044 SQLSTATE: 42000 ER_DBACCESS_DENIED_ERROR Message: Access denied for user ‘%s’@’%s’ to database ‘%s’
Error: 1045 SQLSTATE: 28000 ER_ACCESS_DENIED_ERROR Message: Access denied for user ‘%s’@’%s’ using password: %s
Error: 1046 SQLSTATE: 3D000 ER_NO_DB_ERROR Message: No database selected
Error: 1047 SQLSTATE: 08S01 ER_UNKNOWN_COM_ERROR Message: Unknown command
Error: 1048 SQLSTATE: 23000 ER_BAD_NULL_ERROR Message: Column ‘%s’ cannot be null
Error: 1049 SQLSTATE: 42000 ER_BAD_DB_ERROR Message: Unknown database ‘%s’
Error: 1050 SQLSTATE: 42S01 ER_TABLE_EXISTS_ERROR Message: Table ‘%s’ already exists
Error: 1051 SQLSTATE: 42S02 ER_BAD_TABLE_ERROR Message: Unknown table ‘%s’
Error: 1052 SQLSTATE: 23000 ER_NON_UNIQ_ERROR Message: Column ‘%s’ in %s is ambiguous
Error: 1053 SQLSTATE: 08S01 ER_SERVER_SHUTDOWN Message: Server shutdown in progress
Error: 1054 SQLSTATE: 42S22 ER_BAD_FIELD_ERROR Message: Unknown column ‘%s’ in ‘%s’
Error: 1055 SQLSTATE: 42000 ER_WRONG_FIELD_WITH_GROUP Message: ‘%s’ isn’t in GROUP BY
Error: 1056 SQLSTATE: 42000 ER_WRONG_GROUP_FIELD Message: Can’t group on ‘%s’
Error: 1057 SQLSTATE: 42000 ER_WRONG_SUM_SELECT Message: Statement has sum functions and columns in same statement
Error: 1058 SQLSTATE: 21S01 ER_WRONG_VALUE_COUNT Message: Column count doesn’t match value count
Error: 1059 SQLSTATE: 42000 ER_TOO_LONG_IDENT Message: Identifier name ‘%s’ is too long
Error: 1060 SQLSTATE: 42S21 ER_DUP_FIELDNAME Message: Duplicate column name ‘%s’

Leave a Comment

MySQL Error Codes

MySQL Error Codes- You may receive an error message while using MySQL extention mysqli or PDO, check out this table which will help you to debug your applications.There could be two type of error, the first might be server errors and the second is client errors. The error messages are listed the source in the errmsg.txt file.

Error Code SQL State Message

End of Server Errors Error: 1000 SQLSTATE: HY000 ER_HASHCHK Message: hashchk
Error: 1001 SQLSTATE: HY000 ER_NISAMCHK Message: isamchk
Error: 1002 SQLSTATE: HY000 ER_NO Message: NO
Error: 1003 SQLSTATE: HY000 ER_YES Message: YES
Error: 1004 SQLSTATE: HY000 ER_CANT_CREATE_FILE Message: Can’t create file ‘%s’ errno: %d
Error: 1005 SQLSTATE: HY000 ER_CANT_CREATE_TABLE Message: Can’t create table ‘%s’ errno: %d
Error: 1006 SQLSTATE: HY000 ER_CANT_CREATE_DB Message: Can’t create database ‘%s’ errno: %d
Error: 1007 SQLSTATE: HY000 ER_DB_CREATE_EXISTS Message: Can’t create database ‘%s’; database exists
Error: 1008 SQLSTATE: HY000 ER_DB_DROP_EXISTS Message: Can’t drop database ‘%s’; database doesn’t exist
Error: 1009 SQLSTATE: HY000 ER_DB_DROP_DELETE Message: Error dropping database can’t delete ‘%s’, errno: %d
Error: 1010 SQLSTATE: HY000 ER_DB_DROP_RMDIR Message: Error dropping database can’t rmdir ‘%s’, errno: %d
Error: 1011 SQLSTATE: HY000 ER_CANT_DELETE_FILE Message: Error on delete of ‘%s’ errno: %d
Error: 1012 SQLSTATE: HY000 ER_CANT_FIND_SYSTEM_REC Message: Can’t read record in system table
Error: 1013 SQLSTATE: HY000 ER_CANT_GET_STAT Message: Can’t get status of ‘%s’ errno: %d
Error: 1014 SQLSTATE: HY000 ER_CANT_GET_WD Message: Can’t get working directory errno: %d
Error: 1015 SQLSTATE: HY000 ER_CANT_LOCK Message: Can’t lock file errno: %d
Error: 1016 SQLSTATE: HY000 ER_CANT_OPEN_FILE Message: Can’t open file: ‘%s’ errno: %d
Error: 1017 SQLSTATE: HY000 ER_FILE_NOT_FOUND Message: Can’t find file: ‘%s’ errno: %d
Error: 1018 SQLSTATE: HY000 ER_CANT_READ_DIR Message: Can’t read dir of ‘%s’ errno: %d
Error: 1019 SQLSTATE: HY000 ER_CANT_SET_WD Message: Can’t change dir to ‘%s’ errno: %d
Error: 1020 SQLSTATE: HY000 ER_CHECKREAD Message: Record has changed since last read in table ‘%s’
Error: 1021 SQLSTATE: HY000 ER_DISK_FULL Message: Disk full %s; waiting for someone to free some space…
Error: 1022 SQLSTATE: 23000 ER_DUP_KEY Message: Can’t write; duplicate key in table ‘%s’
Error: 1023 SQLSTATE: HY000 ER_ERROR_ON_CLOSE Message: Error on close of ‘%s’ errno: %d
Error: 1024 SQLSTATE: HY000 ER_ERROR_ON_READ Message: Error reading file ‘%s’ errno: %d
Error: 1025 SQLSTATE: HY000 ER_ERROR_ON_RENAME Message: Error on rename of ‘%s’ to ‘%s’ errno: %d

To be continued in next post….

Leave a Comment

Mysqlaccess

The mysqlaccess script provides information that can be useful in detect problems with user access to a given database. However before you process for this script you should make sure that you must always do a ‘mysqladmin reload’ after making changes to the MySQL database tables.

Mysqlaccess script support the following option. You may use either the “short” single character or more verbose versions.

-?, –help Display help message.
-v, –version Print version information.
-u, –user=… Username to use for logging into database.
-p, –password=… Password to use for logging into database. Note there can be no space between the -p and the password.
-h, –host=… Name of host to use for host permissions check.
-d, –db=… Name of database to use for database permissions check.
-U, –superuser=… Name of superuser account.
-P, –spassword=… Password for the superuser account.
-b, –brief Print single-line tabular report.
–relnotes Print release notes
–plan Print suggestions/ideas for future releases
–howto Print examples of how to run `mysqlaccess’
–debug=N Enter debuglevel N (0..3)

You should note that you need to also specify the user and db you would like to check. If no host is given, it would be assumed as ‘localhost’.

Leave a Comment

How to Check DDOS attack on server

An useful and useful command for checking if a server is under ddos?:

netstat -anp |grep ‘tcp\|udp’ | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -n

This command will list the IPs checking the most amounts of connections to a server, it’s important to note that the ddos is becoming more and more planned and hackers are using most sophisticated method. If this is the case you will still get low number of connections even while you are under a DDOS.

Another vital thing to look at is how many active connections your server is processing at the most.

netstat -n | grep :80 |wc -l

netstat -n | grep :80 | grep SYN |wc -l

The first command will show the number of active connections which are open to your server, most of the attacks typically starting a connection to the server and then not sending any reply making the server wait for longer time. The number of active connections from the first command is going to differ in large amount but if you are much above 500 you are probably having problems. If the second command is over 100 you are having trouble with a syn attack.

To Block a certain IP address that on server, you can use following commands

—————–command——————————

route add ipaddress reject

for example route add 192.168.0.168 reject

You can check whether given IP is blocked on server by using following command

route -n |grep IPaddress

—————–command——————————

OR

use follwoing command to block a ip with iptables on server
—————–command——————————
iptables -A INPUT 1 -s IPADRESS -j DROP/REJECT

service iptables restart

service iptables save

—————–command——————————

Then KILL all httpd connection and restarted httpd service by using following command

killall -KILL httpd

service httpd startssl

Hope this help!

Leave a Comment

Hyper-V Monitor Gadget for Windows Sidebar

If you want to monitor your Hyper-V server working at your workstation? If you want to see instantly when server or virtual machine goes down? Here is a nice gadget for Windows 7 and Windows Vista. Hyper-V Monitor Gadget for Windows Sidebar displays all necessary information from your remote Hyper-V servers.

Hyper v monitor gadget

With this tiny gadget you can see the list of all your Hyper-V servers, and list of all virtual machines created on that servers and their status, it support vmconnect too when double clicking on a VM. Version 5.0 has just come out, with some new features, check the official announcement of the new version and download and try it, It’s free..

Leave a Comment

Common Errors Using MySQL Programs

Here is the list of some common errors that users often encounter when running MySQL programs.

Common Errors-MySQL Programs

B.5.2.1. : Access denied
B.5.2.2. : Can’t connect to [local] MySQL server
B.5.2.3. : Lost connection to MySQL server
B.5.2.4. : Client does not support authentication protocol
B.5.2.5. : Password Fails When Entered Interactively
B.5.2.6. : Host ‘host_name’ is blocked
B.5.2.7. : Too many connections
B.5.2.8. : Out of memory
B.5.2.9. : MySQL server has gone away
B.5.2.10.: Packet too large
B.5.2.11.: Communication Errors and Aborted Connections
B.5.2.12.: The table is full
B.5.2.13.: Can’t create/write to file
B.5.2.14. :Commands out of sync
B.5.2.15. : Ignoring user
B.5.2.16. :Table ‘tbl_name’ doesn’t exist
B.5.2.17. : Can’t initialize character set
B.5.2.18. : File’ Not Found and Similar Errors
B.5.2.19. : Table-Corruption Issues

Although the problems show up when you try to run client programs, most of the time the easiest solutions involves changing the configuration of the MySQL server.

Leave a Comment

How to Avoid receiving message “Windows XP is not genuine”

If your Windows OS keeps on giving you the alert that your XP is not genuine, you can avoid this message using following steps;

Just try this patch
Lauch Windows Task Manager.
End wgatray.exe process in Task Manager.
Restart Windows XP in Safe Mode.
Delete WgaTray.exe from c:\Windows\System32.

Delete WgaTray.exe from c:\Windows\System32\dllcache.

Lauch RegEdit.
Browse to the following location:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\
Windows NT\CurrentVersion\Winlogon\Notify
Delete the folder ‘WgaLogon’ and all its contents
Reboot Windows XP

If it still dont resolve the issue then better you should reinstall XP and when installing make sure to not to tick online updates the Geniun XP patch or what ever like such this.

Enjoy..

Leave a Comment

Reset Urchin password On Windows server

Reset Urchin password On Windows server :

Start up a Command Prompt window and type the following :

>cd \Program Files\Urchin\util
>uconf-driver action=set_parameter table=user \
name=”(admin)” ct_password=password

That’s all, you’ve reset Urchin password.

Leave a Comment