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/

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

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

Sep 1, 2011

Easy 5 Ways to Increase the PHP Memory Limit in WordPress

  • In case you are a blogger & you use Wordpress; on some hosts you’ll notice a ‘Fatal Error : Memory Size Exhausted’ when you install a lot of plugins, upgrade to the latest WordPress version or even you’ll find an error in your Dashboard widget which prevents them from loading fully. In case you want to reduce your plugins, then you can take a look at the Top 10 Wordpress Plugins I use on DailyBlogging. Such types of problems arise because the PHP Memory Limit of your Host is pretty less than what the process requires for performing it’s functions. In such a case you would need to follow these 5 tips to Increase your host’s PHP Memory Limit.
  • ( I got when I upgraded from WordPress 3.0.3 –> WordPress 3.0.4. You’ll find that there is some problem with class-http.php on line 1408. It’s not necessary that you’ll also get the same error. But as far as WordPress Upgrades are concerned; you’ll experience a similar error on your Dashboard too.)
  1. Increase the limit via PHP.ini file
ou can directly increase the PHP Memory Limit if you’ve access to the PHP.ini file. Most small Shared hosting servers won’t give you access to the PHP.ini file. But some servers allow you to create a duplicate PHP.ini in your respective site Directories whose data/values will override the default PHP.ini values. [ad#adsense-incontent]

To do that you just need to create a file with the name ‘php.ini’ in the directory where your WordPress site is installed. In that just add the command memory_limit = 64M in it to increase the Memory Limit to 64 MB.

2. Changing the Memory Limit via wp-config.php

If you don’t want to mess with the PHP.ini file, then you can go for this method. In this you won’t be needing to create any extra file in your Directory. Just Adding define('WP_MEMORY_LIMIT', '64M'); in your ‘wp-config.php’ file would increase your PHP Memory Limit to 64 MB.

3 Modifying the .htaccess file to Increase the Memory Limit

A Default WordPress Installation won’t have a .htaccess file. But in case you already have it for some purposes like ‘301 Redirection’ which is important in SEO of any site. In such a case just add the command php_value memory_limit 64M in your ‘.htaccess’ file and your memory limit will increase to 64 MB.

4. Changing the Memory Limit via install.php

This method is just an Alternate to the php.ini method. Because the function of the code we use in this method is same as what we put in the php.ini file. You just need to place the code ini_set('memory_limit','32M'); in the ‘install.php’ file which is placed in the wp-admin folder of your WordPress installation.

5 Have a talk with your Host

If you are a person who is new to all these techie sounding things. Then it’s better to have a Live Chat / a Call with your Host right away. It’s your right to talk to them & get the necessary changes you need as you’ve paid for it. I would recommend you use some Quality WordPress hosts available

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