upgrade MariaDB 5.5->10.3 CentOS 7

CentOS 7 is shipped with MariaDB. MariaDB 10.x version is a drop-in replacement for MySQL 5.5-5.7.

  1. Create a backup of all databases with the following command:

    # MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysqldump -u admin –all-databases –routines –triggers > /tmp/all-databases.sql

  2. Stop the MariaDB service:

    # service mariadb stop

    Note: Remove additional packages like mariadb-bench:

    # rpm -e mariadb-bench

  3. Copy a databases directory in a separate folder like this (for backup purposes also):

    # cp -a /var/lib/mysql/ /var/lib/mysql_backup

  4. Check if you already have mysql-server installed:

    # rpm -q –whatprovides mysql-server

    If it is installed and the command above gives output, it is required to be removed using the following command:

    # rpm -e –nodeps `rpm -q –whatprovides mysql-server`

  5. Configure MariaDB repository: open the Setting MariaDB repositories page, select OS distro, release and MariaDB version to see the configuration that should be added to /etc/yum.repos.d/MariaDB.repo file. Example for MariaDB 10.1:

    # vi /etc/yum.repos.d/MariaDB.repo

    [mariadb]
    name = MariaDB
    baseurl = http://yum.mariadb.org/10.1/centos7-amd64
    gpgkey = https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
    gpgcheck = 1

  6. Perform an upgrade with:

    # yum install MariaDB-client MariaDB-server

  7. Start the MariaDB service:

    # service mariadb start

    OR

    # service mysql start

  8. Upgrade MySQL databases:

    # MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql_upgrade -uadmin

  9. Restart mysql service:

    # service mariadb restart

    OR

    # service mysql restart

upgrade mysql 5.1->5.7 (CentOS 6)

first, upgrade from 5.1 to 5.5 https://support.plesk.com/hc/en-us/articles/213367429

 

  • Install the Atomicorp repository:

    wget -q -O – http://www.atomicorp.com/installers/atomic | sh

  • Upgrade MySQL:

    yum upgrade mysql

 

 

  • Restart the MySQL service:

    service mysqld restart

  • Upgrade MySQL databases:

    mysql_upgrade -uadmin -p`cat /etc/psa/.psa.shadow`

  • In case the message below appears, refer to the KB article Error during yum upgrade: Packages excluded due to repository protections:

    yum upgrade mysql
    ….
    881 packages excluded due to repository protections
    No Packages marked for Update

 

Next, update from 5.5->5.7 https://support.plesk.com/hc/en-us/articles/213403429-How-to-upgrade-MySQL-5-5-to-5-6-5-7-or-MariaDB-5-5-to-10-0-10-1-10-2-on-Linux

  1. Stop the MySQL service:

    # service mysqld stop

  2. Create a backup of databases:

    # cp -a /var/lib/mysql /var/lib/mysql_backup

    Note: Disable Atomic repository, if it is enabled:

    # vi /etc/yum.repos.d/atomic.repo
    enabled = 0

  3. Install the MySQL-community repository:

    # yum install https://dev.mysql.com/get/mysql80-community-release-el6-1.noarch.rpm

  4. Select a MySQL version:

    # vi /etc/yum.repos.d/mysql-community.repo
    [mysql56-community]
    enabled=0
    [mysql57-community]
    enabled=1

  5. Install MySQL packages:

    # yum update mysql

    If update of mysql package ends with Nothing to do message, make sure that mysql* packages are not added to excludes in yum.conf file and remove it if it is in the list:

    # cat /etc/yum.conf | grep exclude
    exclude=php-common php-cli php mysql* httpd* mod_ssl*

  6. Type y if this message appears:

    warning: rpmts_HdrFromFdno: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
    Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
    Importing GPG key 0x5072E1F5:
    Userid : MySQL Release Engineering <mysql-build@oss.oracle.com>
    Package: mysql57-community-release-el6-7.noarch (@/mysql57-community-release-el6-7.noarch)
    From : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
    Is this ok [y/N]:

  7. Start the MySQL service:

    # service mysqld start

    If the service does not start, check the following article: MySQL fails to start: mysql.user table is damaged.

  8. Upgrade MySQL databases:

    # MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql_upgrade -uadmin

  9. Restart mysql service:

    # service mysqld restart

 

setup gmail to POP your new account

Open Gmail.
In the top right, click Settings Settings and then Settings.
Click the Accounts tab.
In the 3rd section, click Add a mail account
Follow the steps on the screen
email address: you@yourdomain.com
(Next)
username: you@yourdomain.com (it will default to just part of your address – make sure you type the full email address)
password:
POP server: yourdomain.com
Port 110
Leave all other boxes unchecked
(Add Account)
Yes, I want to be able to send mail as you@yourdomain.com
(Next)
Name: you@yourdomain.com
Treat as an alias – leave checked
(Next Step)
SMTP Server: yourdomain.com
Port: 25
Username: you@yourdomain.com (it will default to just part of your address – make sure you type the full email address)
Password:
Unsecured connection
(Add Account)
You will get a popup screen asking that you enter a verification code that was sent to your you@yourdomain.com account – a bit of a catch22, huh? How can you get the verification code to setup gmail if gmail is not setup to get the code yet? Well, we have you covered…..just a few more steps. In a separate window:
go to http://webmail.yourdomain.com
username: you@yourdomain.com
password:
(login)
click the Mail link in the top left
you should see the email from gmail. Get the verification code.
Enter verification code into google screen and submit
If all went well – you should be done!

have .html files run as .php

A client ran into an interesting problem to get .html files parsed as .php. It was not enough to add a .htaccess directive for php-script because then the php.ini file was used out of the /etc directory instead of the domain’s custom php.ini file. He had to do the following.

I was researching the problem and finally figured out the answer. Just in case you ever get asked again, I added the following to my .htaccess file and now works with the right php.ini file.

AddHandler php-script .html

SetHandler fcgid-script
FCGIWrapper /var/www/cgi-bin/cgi_wrapper/cgi_wrapper .html
Options +ExecCGI

Originally I only had the “AddHandler php-script .html” in the .htaccess file which made it work, but did not pull in the right php.ini file.

Thanks Robert!

credit:
Robert Thaller | Net-Flow Corporation
1556 First Street, Suite 103, Napa, CA 94559
Phone 707-259-1233
Fax 707-255-7218
rthaller@net-flow.com

libarchive error after upgrade to plesk 12.5

Error:

Fatal error during packages installation: Test Transaction Errors: package libarchive-2.8.4-11082614.x86_64 (which is newer than libarchive-2.8.4-6.el5.i386) is already installed

YumTestTransactionError: Test Transaction Errors: package libarchive-2.8.4-11082614.x86_64 (which is newer than libarchive-2.8.4-6.el5.i386) is already installed

Error: Failed to run the Yum utility.
The Yum utility failed to install the required packages.
Attention! Your software might be inoperable.
Please, contact product technical support.

Fix:


rpm -e --nodeps libarchive
wget -q https://dl.fedoraproject.org/pub/epel/epel-release-latest-5.noarch.rpm
rpm -Uvh epel-release-latest-5.noarch.rpm
yum install libarchive
/usr/local/psa/admin/bin/autoinstaller

Enable Nginx support


/usr/local/psa/admin/bin/nginxmng -e

CT-4968585-bash-4.1# service nginx reload
Reloading nginx: [FAILED]
CT-4968585-bash-4.1# /usr/local/psa/admin/bin/nginxmng -d
CT-4968585-bash-4.1# /usr/local/psa/admin/bin/nginxmng -e
CT-4968585-bash-4.1# service nginx restart
Starting nginx: [ OK ]

http://kb.odin.com/en/119053

Some of the selected subscriptions were not suspended. MySQL query failed: Unknown column ‘fp’ in ‘field list’

Some of the selected subscriptions were not suspended.
MySQL query failed: Unknown column ‘fp’ in ‘field list’

Create backup of psa database:
# mysqldump -uadmin -p`cat /etc/psa/.psa.shadow` psa > psa.sql

Login to database:
# mysqldump -uadmin -p`cat /etc/psa/.psa.shadow ` psa > psa`date +%F_%H.%M`.sql

Add required fields to table, e.g.:
# mysql -uadmin -p`cat /etc/psa/.psa.shadow ` psa


ALTER TABLE psa.hosting ADD fp enum('false','true') NOT NULL default 'false';
ALTER TABLE psa.hosting ADD fp_ssl enum('false','true') NOT NULL default 'false';
ALTER TABLE psa.hosting ADD fp_enable enum('false','true') NOT NULL default 'false';
ALTER TABLE psa.hosting ADD fp_adm varchar(20) NOT NULL;
ALTER TABLE psa.hosting ADD fp_pass varchar(20) NOT NULL;

sqldumpscript

Here is a good script for backing up all mysql database on a Plesk server. Add a cron entry so that it runs everyday. Change the ‘-mtime +7’ value to determine how many days of backups you will keep.

vi /usr/local/sbin/sqldumpscript
chmod 755 /usr/local/sbin/sqldumpscript


#! /bin/bash

TIMESTAMP=$(date +"%F")
BACKUP_DIR="/var/www/vhosts/mysqldumps/$TIMESTAMP"
MYSQL=/usr/bin/mysql
MYSQLDUMP=/usr/bin/mysqldump
find /var/www/vhosts/mysqldumps/ -maxdepth 1 -type d -mtime +7 -exec rm -rf {} \;

mkdir -p "$BACKUP_DIR"

databases=`$MYSQL -uadmin -p\`cat /etc/psa/.psa.shadow\` -e "SHOW DATABASES;" | grep -Ev "(Database|information_schema)"`

for db in $databases; do
$MYSQLDUMP --force --opt --skip-events --skip-lock-tables -uadmin -p`cat /etc/psa/.psa.shadow` --databases $db | gzip > "$BACKUP_DIR/$db.gz"
done

create crontab entry
39 3 * * * /usr/local/sbin/sqldumpscript