Friday, July 4, 2014

InnoDB: Database was not shut down normally!

mysql crashes frequently

Solution : 1
Restart your machine.

If it does not solve the problem and mysql crashes frequently with same error.

Solution : 2
Check attribute max_allowed_packet in the file my.cnf
max_allowed_packet=128M
OR
max_allowed_packet=256M

Restart mysql.
If it is not there, add it and restart mysql.

but if it does not solve the problem and mysql crashes frequently with same error.

Solution : 3
Repair all databases of mysql using following commands.
mysqlcheck --no-defaults --check-upgrade --all-databases --auto-repair
mysqlcheck --no-defaults --all-databases --fix-db-names --fix-table-names

If still your mysql crashes frequently.
Reinstall it again.

Allow / Block ssh / sftp for specific Users / Group

Allow ssh / sftp to selected users
If you want to give ssh / sftp privileges to certain users, here is the solution.
Add following line in the file /etc/sshd_config
AllowUsers username1 username2 username3
If you want to allow certain groups only, add following line in /etc/sshd_config
AllowGroups username1 username2 username3
Restart service ssh.

Block ssh / sftp for selected users
If you want to restrict certain users to access ssh / sftp, here is the solution.
Add following line in the file /etc/sshd_config
DenyUsers username1 username2 username3
If you want to block certain groups only, add following line in /etc/sshd_config
DenyGroups username1 username2 username3
Restart service ssh.

Extract an iso file in Linux using command line

Extract an iso file on terminal in Linux

Run following command
sudo mount -o loop "/path/of/iso/file.iso" /mnt
Example :
sudo mount -o loop "/home/user/Downloadsubuntu-12.04.3-desktop-i386.iso" /mnt


Now the iso file contents will be mounted in /mnt
You can copy them anywhere.
sudo cp -r /mnt /your/desired/destination/directory
Example :
sudo cp -r /mnt /home/user/Documents/files


If you do not want to use command line, you can extract it using Archive Manager.
Right click on the iso file and select "Extract here'.
If you have Archive manager, you can mount it using Archive Mounter and files will be opened as separate drive.