Monday, January 21, 2013

Linux Server Time

Linux servers time may be not adjusted to the local time zone so it may make some problem if we use the time in any process in our project.
To know the current time of the server:

1- Login to ssh.
2- Type the date command: date
3- The result will be something like that: Mon Jan 21 04:24:53 EST 2013

All Times are saved in a folder in the system its path is: /usr/share/zoneinfo/

and the local time of the server in the file its path is: /etc/localtime

We can change it to the local time zone by one command:
cp /usr/share/zoneinfo/Egypt /etc/localtime

Now if we type date it will return the local time of Egypt...

Regards,

Monday, January 14, 2013

MySQL Logs

MySQL have many types of logs which make debugging more easily...
To know logs are enabled or not we should follow this steps:
1- Login using SSH
2- Connect to mysql server: mysql -u[username] -p[password]
3- Run : mysql> show variables like '%log%';
The Result of query will be some thing like this:

+---------------------------------+---------------------------+
| Variable_name                   | Value                     |
+---------------------------------+---------------------------+
| log                             | ON                        | 
| log_bin                         | OFF                       | 
| log_bin_trust_function_creators | OFF                       | 
| log_error                       | /var/log/mysqld.error.log | 
| log_slow_queries                | OFF                       | 
+---------------------------------+---------------------------+
26 rows in set (0.00 sec)

as we see the logs are not enabled so we need to enable it using some steps:
1- open my.cnf file (may be in /etc/mysql/my.cnf)
2- find [mysqld] section and write

log-bin
log
log-error
log-slow-queries
below it.
3- save the file and restart mysql service: sudo restart mysql
The logs will be created, by default, in the same data directory that holds the database subdirectories themselves (typically /var/lib/mysql) and the log file names default to the hostname followed by a suffix that matches the directive names above (eg. -bin, -slow-queries, etc).
Sources:
1- http://dev.mysql.com/doc/refman/5.0/en/server-logs.html
2- http://serverfault.com/questions/71071/how-to-enable-mysql-logging

Saturday, January 12, 2013

Description

 . . . بسم الله الرحمن الرحيم . . .
This Blog will have any experience i gain from my study, my work or my life. . .
Aiming to be a good source for any problem solution. . .

Regards,