HostwareSupport-Linux Hosting technical support for cPanel, Plesk, Directadmin servers

Linux Hosting technical support for cPanel, Plesk, Directadmin and No control panel servers offers and listing
http://hostwaresupport.com/

Dec 9, 2011

phpBB SQL Error - 'phpbb_sessions' is marked as crashed and should be repaired

General errorL
SQL ERROR [ mysqli ]


Table './mysql/phpbb_login_attempts' is marked as crashed and should be repaired [145]
**********************************************************************

Recently, my phpBB forum encountered a SQL error, shown below:
'phpbb_sessions' is marked as crashed and should be repaired [145]
The first thing that I did was to access phpMyAdmin to try an repair the table with the SQL command:
REPAIR TABLE 'phpbb_sessions'
Unfortunately, that does not work. I did some research online and finally, I managed to resolve the issue. It takes a bit of tweaking nonetheless, but it's a fairly simple procedure.
Solution to Resolve phpBB error
If you have access to phpMyAdmin application, under cPanel (from your web hosting service provider), then it would make things a lot simpler.
  1. Under your control panel , click on phpMyAdmin icon.
Select your phpBB database, and then click on the "xxx_sessions", where "xxx" represents your phpBB database suffix (In my example, my prefix is phpbb).
php Sessions

Next, click on SQL, located that top of the phpMyAdmin application. This will then open up the dialog box.
phpMyAdmin SQL

  1. In the dialog box (shown below), type in the following SQL command.
    SQL Dialog box
    SQL Code Below
    DROP TABLE IF EXISTS phpbb_sessions;
    CREATE TABLE phpbb_sessions (
    session_id binary(32) DEFAULT '' NOT NULL,
    session_user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
    session_forum_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
    session_last_visit int(11) UNSIGNED DEFAULT '0' NOT NULL,
    session_start int(11) UNSIGNED DEFAULT '0' NOT NULL,
    session_time int(11) UNSIGNED DEFAULT '0' NOT NULL,
    session_ip varbinary(40) DEFAULT '' NOT NULL,
    session_browser varbinary(150) DEFAULT '' NOT NULL,
    session_forwarded_for varbinary(255) DEFAULT '' NOT NULL,
    session_page blob NOT NULL,
    session_viewonline tinyint(1) UNSIGNED DEFAULT '1' NOT NULL,
    session_autologin tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
    session_admin tinyint(1) UNSIGNED DEFAULT '0' NOT NULL,
    PRIMARY KEY (session_id),
    KEY session_time (session_time),
    KEY session_user_id (session_user_id),
    KEY session_fid (session_forum_id)
    );
  2. The above code will typically delete the 'phpbb_sessions' table and re-create a new one.
After you have completed the above procedure, you should see no error on the phpBB Forums now.
Fixed..!
***************************************************************************************************************************

Sep 18, 2011

How to backup your Mysql database with phpMyAdmin



Introduction
It is very important to do backup of your MySql database, you will probably realize it when it is too late.
A lot of web applications use MySql for storing the content. This can be blogs, and a lot of other things. When you have all your content as html files on your web server it is very easy to keep them safe from crashes, you just have a copy of them on your own PC and then upload them again after the web server is restored after the crash. All the content in the MySql database must also be backed up. A lot of web service providers say they do backup of all the files, but you should never blindly trust them. If you have spent a lot of time making the content and it is only stored in the Mysql server, you will feel very bad if it gets lost for ever. Backing it up once every month or so makes sure you never loose too much of your work in case of a server crash, and it will make you sleep better at night. It is easy and fast, so there is no reason for not doing it.

Backup of Mysql database
It is assumed that you have phpMyAdmin installed since a lot of web service providers use it.

0. Open phpMyAdmin.
1. Click Export in the Menu to get to where you can backup you MySql database.

2. Make sure that you have selected to export your entire database, and not just one table. There should be as many tables in the export list as showing under the database name.

3. Select"SQL"-> for output format, Check "Structure" and "Add AUTO_INCREMENT" value. Check "Enclose table and field name with backquotes". Check "DATA", check use "hexadecimal for binary field". Export type set to "INSERT".
4. Check "Save as file", do not change the file name, use compression if you want. Then click "GO" to download the backup file.
========================================================================
Restoring a backup of a MySql database
1. To restore a database, you click the SQL tab.
2. On the "SQL"-page , unclick the show query here again.
3. Browse to your backup of the database.
4. Click Go.
========================================================================

Without phpMyAdminphpMyAdmin has some file size limits so if you have large databases it may no be possible to backup using phpMyAdmin. Then you have to use the command line tools that comes with Mysql. Please note that this method is untested.

Mysql backup without phpMyAdmin
PHPMyAdmin can't handle large databases. In that case straight mysql code will help.
1. Change your directory to the directory you want to dump things to:
root@tune:~> cd files/blog
2. Use mysqldump (man mysqldump is available):
root@tune:~/files/blog> mysqldump --add-drop-table -h mysqlhostserver  -u mysqlusername -p databasename (tablename tablename tablename) | bzip2  -c > blog.bak.sql.bz2  Enter password: (enter your mysql password) root@tune~/files/blog>
Example: mysqldump --add-drop-table -h db01.example.net -u dbocodex -p dbwp | bzip2 -c > blog.bak.sql.bz2  Enter password: my-password root@tune~/files/blog> 
The bzip2 -c after the pipe | means the backup is compressed on the fly.
Mysql restore without phpMyAdmin
The restore process consists of unarchiving your archived database dump, and importing it into your Mysql database.
Assuming your backup is a .bz2 file, creating using instructions similar to those given for Backing up your database using Mysql commands, the following steps will guide you through restoring your database :
1. Unzip your .bz2 file:
root@tune:~/files/blog> bzip2 -d blog.bak.sql.bz2
Note: If your database backup was a .tar.gz called blog.bak.sql.tar.gz file, then,
tar zxvf blog.bak.sql.tar.gz
is the command that should be used instead of the above.2. Put the backed-up sql back into mysql:
root@tune:~/files/blog> mysql -h mysqlhostserver -u mysqlusername  -p databasename < blog.bak.sql  Enter password: (enter your mysql password) root@tune~/files/blog:> 
========================================================================

Table mysql.servers doesn’t exist: Problem adding a database user in plesk Or restarting mysql

You may receive a “Table ‘mysql.servers’ doesn’t exist” error message while adding a database user in Plesk OR while restarting the Mysql service. The complete error message look like:

Error: Connection to the database server has failed: Table 'mysql.servers' doesn't exist

OR

Can't open and lock privilege tables: Table 'mysql.servers' doesn't exist

The problem mostly occurs when Mysql server is upgraded from an older to a newer version and the upgrade remains incomplete. Since Mysql often introduces new tables with the newer versions, you need to run the “mysql_fix_privilege_tables” script located in the “/usr/bin/” directory so the mysql database is updated with the latest contents thus fixing the privileges of the database users as well.

To fix the issue, ssh to your server as root and execute the command:

On a plain Linux OR Linux/cPanel server:

# mysql_fix_privilege_tables --user=root --password= --verbose

On a Linux/Plesk server:

# mysql_fix_privilege_tables --user=admin --password=`cat /etc/psa/.psa.shadow` --verbose

BTW, on a Linux/Plesk server, you may see the following error message sometimes:

Got a failure from command:
cat /usr/share/mysql/mysql_fix_privilege_tables.sql | /usr/bin/mysql –no-defaults –force –user=root –host=localhost –database=mysql
If you get an ‘Access denied’ error, you should run this script again and
give the MySQL root user password as an argument with the –password= option

In such a situation, use user/password argument with privilege command as follows:

# mysql_fix_privilege_tables --user=admin --password=`cat /etc/psa/.psa.shadow`  --verbose

where, –verbose will display the detailed output.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------


7

Sep 16, 2011

Different Qmail queue tricks in Linux plesk


Following are some of the qmail commands for Plesk server.

1) To check the mail queue in plesk from command line, you can use the command :

[root@vps init.d]# /var/qmail/bin/qmail-qstat
messages in queue: 1
messages in queue but not yet preprocessed: 0
[root@vps init.d]#

2) You can examine the queue with qmail-qread.

# /var/qmail/bin/qmail-qread
root@vps init.d]# /var/qmail/bin/qmail-qread
16 Sep 2011 06:14:22 GMT #218926412 299 anonymous@vps.test.com
remote dave@davidlbird.com
[root@vps init.d]#
3) From the qread command you get the message’s id . In the above example , one of the id is 218926412 . Now you can find the file holding the email in/var/qmail/queue with “find “command.


[root@vps init.d]# find /var/qmail/queue -iname 218926412

/var/qmail/queue/mess/15/218926412
/var/qmail/queue/remote/15/218926412
/var/qmail/queue/info/15/218926412

[root@vps init.d]# vi /var/qmail/queue/mess/22/524514

Received: (qmail 9264 invoked by uid 10000); 16 Sep 2011 06:14:22 -0700
Date: 16 Sep 2011 06:14:22 -0700
Message-ID: <20110916131422 .9260.qmail=".9260.qmail" vps.pcbuniverse.com="vps.pcbuniverse.com">
To: Dave@DavidLBird.com
Subject: the subject
From: tchase@pcbuniverse.com
Reply-To: tchase@pcbuniverse.com
X-Mailer: PHP/5.1.6
hello
~


5) If you wish to remove the emails with some patterns , you can use qmail-remove ( You can download it from http://www.linuxmagic.com/opensource/qmail/qmail-remove )

# /etc/init.d/qmail stop (Stop qmail before removing)
# /var/qmail/bin/qmail-remove -r -p “Time Passing”
(considering that “Time Passing” was the subject of the email )
The above steps can be used to track Spammers .
Do you wish to completely remove all the mails from queue? Just run the below commands.
find /var/qmail/queue/mess -type f -exec rm {} \;
find /var/qmail/queue/info -type f -exec rm {} \;
find /var/qmail/queue/local -type f -exec rm {} \;
find /var/qmail/queue/intd -type f -exec rm {} \;
find /var/qmail/queue/todo -type f -exec rm {} \;
find /var/qmail/queue/remote -type f -exec rm {} \;

Sep 12, 2011

Under plesk account if domain webamail link shows blue screen or default plesk page.. then how can you fixed this..

Solution:
Login to your plesk server through root



[master@tunevps ~]$ sudo su - root

[master@tunevps ~]
[master@tunevps ~]cd /etc/psa/webmail/horde/conf.d/

[master@tunevps ~:/etc/psa/webmail/horde/conf.d]
(root)>ls -al | grep testvps.com
[master@tunevps ~:/etc/psa/webmail/horde/conf.d]
[master@tunevps ~] cp -a /etc/psa-webmail/horde/conf.d/tugawarsportfishing.com /etc/psa/webmail/horde/conf.d

[master@tunevps ~:/etc/psa/webmail/horde/conf.d]
[master@tunevps] service httpd stop
Stopping httpd: [ OK ]
[master@tunevps:/etc/psa/webmail/horde/conf.d]
[master@tunevps] service httpd start
Starting httpd: [ OK ]

This should be fixed your problem

====================================================================