Upgrading phpMyAdmin – cPanel

The phpMyAdmin version is usually automatically upgraded when you run a cPanel update to a newer version. However, if you’re not quite ready to upgrade cPanel, you easily install a newer version of phpMyAdmin. Please be aware that future cPanel updates will overwrite your manual installation.

You will need to go to the phpMyAdmin download page and pick your version. This tutorial is specific to version 2.11, but should work for any:

cd /usr/local/cpanel/base/3rdparty
mv phpMyAdmin hold_phpmyadmin

wget http://prdownloads.sourceforge.net/phpmyadmin/phpMyAdmin-2.11.2.2-english.tar.gz?download

tar -xvzf phpMyAdmin-2.11.2.2-english.tar.gz
mv phpMyAdmin-2.11.2.2-english phpMyAdmin
cp hold_phpmyadmin/config.inc.php phpMyAdmin/
chown -R cpanel:cpanel phpMyAdmin

Then load up phpMyAdmin from cPanel or WHM and you should see the new version

Installing PostgreSQL – cPanel

Run the install script from command line

/scripts/installpostgres

Now in WHM under SQL Services locate Postgres Config and do an Install Config. You can also set the root password from here, but this password should only be alphanumeric.
PostgreSQL is installed now, but PHP is not compiled for it, so you’ll need to recompile PHP/Apache with postgreSQL support. You can do this manually, or through WHM. If doing so manually, here is the configure switch:

–with-pgsql=/usr

In your feature manager in cPanel, check the boxes for PostgreSQL and phpPgAdmin to enable them in your users’ cPanels.

ow when you log into cPanel you’ll see a section for PostgreSQL and phpPgAdmin which is the database management tool for Postgres.

Incorrect Disk Usage and Unlimited Quotas – cPanel

This is a common bug on cPanel 11 systems, where you do an account listing through Webhost manager or try to set a user’s quota and everyone is showing as using 0mb out of unlimited.  The most common fix for this is to run:

/scripts/fixquotas

This will re-initialize the quota system and usually fix the error.

On VPS servers running Virtuozzo, a kernel bug in earlier versions of CentOS and Redhat have been attributed to this error (and similar errors) as well.

Users Can’t Change Password – cPanel

When trying to change their password in cPanel, users get the following error:

There was an error manipulating the password file.
This generally means you entered your old password incorrectly.

This has been seen on CentOS and Redhat servers running cPanel 11. The known fix is to run:

chmod +s /usr/bin/passwd

Wrong Version Numbers in cPanel

It’s common that when moving a cPanel account between servers with differing software versions, the version numbers (specifically MySQL) on the side of cPanel still reflect those of the old server. This can be changed by editing the version files for the account that was moved:

The files holding the version numbers are located in:

cpanel 10: /home/username/.cpanel-datastore/

cpanel 11: /home/username/.cpanel/datastore/

The following files control the version display in user cPanels:

Apache Version:

_usr_local_apache_bin_httpd_-v

Perl Version:

_usr_bin_perl_-v

MySQL Version:

_usr_sbin_mysqld_–version

Webmail Authentication Fails – cPanel

You know you’re using the right password, so why can’t you log into Webmail? One common issue users see on courier-IMAP systems when trying to log into Horde is:

Notice: (null)(): Retrying LOGIN authentication after AUTHENTICATE LOGIN failed (errflg=1) in Unknown on line 0

Notice: (null)(): Retrying LOGIN authentication after AUTHENTICATE LOGIN failed (errflg=1) in Unknown on line 0

Notice: (null)(): Can not authenticate to IMAP server: AUTHENTICATE LOGIN failed (errflg=2) in Unknown on line 0

To rule out a service failure, restart both cPanel and courier-imap:

/etc/init.d/courier-imap restart

service cpanel restart

The fix that works 98% of the time is to run these commands:

mv /etc/vmail /etc/vmail.bak

/scripts/updateuserdomains

If that doesn’t correct the error, in some cases running a courier update has corrected the issue:

/scripts/courierup –force

Useful MySQL Commands

These command assume you are running a cPanel MySQL installation and logged into the server as a root user where you can do a mysql -u root without having to specify a password.
Import a database:

mysql -u root db_name < file.sql

Dump a Database (with special characters):

mysqldump -Q –add-drop-table db_name > file.sql

Dump a Database, 4.0 compatible:

mysqldump –compatible=mysql40 –add-drop-table –quote-name db_name > file.sql

Dump Multiple Databases:

mysqldump -Q –add-drop-table –databases db_name1 db_name2 > file.sql

Restore Multiple Databases (must be done as root):

mysql -u root < file.sql

Log into MySQL prompt as the user (or root):

mysql -u username -p

Show Databases: (will only show databases the user has access to. Root has all.)

show databases;

Drop a whole database:

drop database user_databasename;

Create a database: *only a root mysql user can use this command

create database user_newdb;

Select a database to work on:

use user_testdb;

Drop a specific table:

drop table table_name;

Show all MySQL Processes:

show full processlist;

MySQL Root Login Failure

When trying to log into the MySQL shell as root you get an access denied error. To fix:

Add this line to /etc/my.cnf and restart MySQL:

skip-grant-tables

Follow these steps to reset the MySQL root password:

mysql -u root

mysql> FLUSH PRIVILEGES;
mysql> GRANT ALL PRIVILEGES ON *.* TO root@localhost IDENTIFIED BY ‘password’ WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;
mysql> exit;

service mysql restart

Remove the line you added to my.cnf and restart MySQL again.

Now go into WHM and reset the MySQL root password again. This is is necessary in order to build an association with cPanel and phpmyadmin, as well as the root user on the server to MySQL (meaning, when logged in as root to the server, you don’t have to specify a mysql root password to log in).

Missing MySQL Socket (mysql.sock) Error

If you get some variation of the error below:

error: ‘Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’

You need to recreate the MySQL socket symlink in /tmp:

ln -s /var/lib/mysql/mysql.sock /tmp/

If you have magically disappearing mysql.sock file, it could point to a memory issue or disk space issue on the /tmp partition.