Friday, May 10, 2013

ERROR 2006 (HY000) at line ##: MySQL server has gone away


 MySQL server has gone away : Error while uploading sql file in phpmyadmin




1) Open file my.cnf 
xampp : /opt/lampp/etc/my.cnf
apache2 (Debian) : /etc/mysql/my.cnf 
httpd (RHEL, CentOS) : /etc/my.cnf

2) Set value max_allowed_packet=128M under attribute [mysqld] 
    If parameter is not there, add it under attribute [mysqld] .
[mysqld] max_allowed_packet=128M

3) Restart mysql.

Access forbidden : New XAMPP security concept : XAMPP - phpmyadmin error

Solution :
Access forbidden :  New XAMPP security concept error in phpmyadmin after new XAMPP installation





1) Open the file /opt/lampp/etc/extra/httpd-xampp.conf

2) Search text #New XAMPP security concept in the file and replace Deny from all to Allow from all under #New XAMPP security concept

3) Add line Require all granted in <Directory "/opt/lampp/phpmyadmin">
 Now it looks like this.
<Directory "/opt/lampp/phpmyadmin">     AllowOverride AuthConfig Limit     Require all granted     Order allow,deny     Allow from all     </Directory>

4) Restart XAMPP

If you are still getting problem

Solution : 2
Run following command
$ sudo /opt/lampp/lampp security
Set password for everything.
Restart XAMPP and try again.



Friday, May 3, 2013

User Status in Linux - Check user is locked or unlocked

If you are using CentOS or RHEL :

If you want to check your user's account status,Run following command :
$ passwd -S "username"
Change the text username with your username whose status you want to check.
If your user is locked, it shows
(Password locked.)
If your user is unlocked, it shows
(Password set, MD5 crypt.)
List of all locked accounts :
$ awk -F: '{ system("passwd -S " $1)}' /etc/passwd | grep " LK "
List of all unlocked accounts :
$ awk -F: '{ system("passwd -S " $1)}' /etc/passwd | grep " PS "

If you are using Debian or Ubuntu :

If you are using Debian or Ubuntu and your user is locked, it shows letter L with your username.

If you are using Debian or Ubuntu and your user is unlocked, it shows letter P with your username
List of all locked accounts :
$ awk -F: '{ system("passwd -S " $1)}' /etc/passwd | grep " L "
List of all unlocked accounts :
$ awk -F: '{ system("passwd -S " $1)}' /etc/passwd | grep " P "

Note :
If you are using CentOS 7 and you run following command to list all users with status
passwd -S -a
It gives following error
passwd: bad argument -a: unknown option
 

Use following command to list all users with their status
awk -F: '{ system("passwd -S " $1)}' /etc/passwd