July 14, 2015

Installing Custom MySQL Versions

If at all possible, you should use WHM to install MySQL, however, if you need a version of MySQL outside of what they are offering in current cPanel versions, it is possible to install your own versions.
These instructions can also be used to install MariaDB!  For more info on this, see cPanel’s blog.
It should be noted that some versions of cPanel do not officially support certain versions of MySQL, or installing MySQL in the fashion that is about to be described.  So do this at your own risk! Going to a minor version that is not supported by cPanel may also prevent cPanel updates from running at all.

Make Backups

If this is on a live system, make sure to make backups of the databases.
mkdir /root/dbbackups
touch /root/dbbackups/list
for db in `mysql -e 'show databases' |awk '{print $1}' | grep -v Database` ; do
    mysqldump --add-drop-table $db > /root/dbbackups/$db.sql && echo $db >> list
done

Download Packages

Download the binaries for the OS version and MySQL version you are using from the cPanel repo.  You can find MySQL packages on these sites:
You can also download the RPMs from MySQL’s website – though it’s not officially supported by cPanel, using the vendor RPM seems to work just fine.

Break up cPanel and MySQL

Now, you need to tell cPanel not to try to manage MySQL binaries anymore:
/scripts/update_local_rpm_versions –edit target_settings.MySQL50 unmanaged
/scripts/update_local_rpm_versions –edit target_settings.MySQL51 unmanaged
/scripts/update_local_rpm_versions –edit target_settings.MySQL55 unmanaged
/scripts/update_local_rpm_versions –edit target_settings.MySQL56 unmanaged

Uninstall Existing MySQL

To remove existing MySQL packages from the server:
/scripts/check_cpanel_rpms –fix –targets=MySQL50,MySQL51,MySQL55,MySQL56

Install New MySQL Packages

Go back to where you downloaded the packages to on your server, and install them:
rpm -Uvh mysql-*
Then check to see that the new version is indeed installed:
root@server [~]# mysql -V
mysql  Ver 14.14 Distrib 5.5.35, for Linux (x86_64) using readline 5.1
If you moved between minor versions (ie, 5.1 to 5.5), you should also run:
mysql_upgrade
You may also need to run EasyApache if PHP ceases to function.  However, you can get around this by copying the MySQL client libraries from /usr/lib[64] to another location before upgrading, then moving them back afterwards.  This is only a band-aid though, and should only be used to allow enough time to recompile PHP.

Related Posts:

  • Một số lệnh quản lý mysql bạn nên biết1. Đổi mật khẩu user root Khi mới cài đặt MySQL, user root với quyền tối cao sẽ được tạo ra với mật khẩu bằng trống (không có mật khẩu. Do vậy việc đầu tiên chúng ta nên làm sẽ là đổi mật khẩu cho user này để đảm bảo an toàn… Read More
  • Hướng dẫn repair MySQL databaseKhi database bị crash table, để repair các database này, ta thực hiện các cách sau đây: -Đối với database sử dụng engine InnoDB, thêm "innodb_force_recovery = 1" vào file my.cnf và restart dịch vụ mysql. Sau khi việc repair… Read More
  • Các câu lệnh MySQL cần phải biết Khi chạy các lệnh này, bạn cần login vào MySQL với tài khoản root (MySQL root chứ không phải tài khoản root quản lý VPS) hoặc tài khoản có full quyền. Tất cả các thao tác mình thực hiện trên VPS CentOS Đăng nhập MySQL … Read More
  • Cài đặt MySQL Server trên CentOS << Đồng bộ hóa dữ liệu trên 2 Database Server dùng SQL Server 2008 | Cài đặt Apache và PHP trên CentOS >> Cài đặt MySQL Server trên CentOS Đăng vào ngày 20 Tháng Tư 2011 lúc 09:42 bởi Duy Khánh… Read More
  • phục hồi mysql replication break Giới thiệu Khi mysql replication bị hỏng thì có rất nhiều cách để xử lý nhưng có một cách tốt hơn cả là có thể bê nguyên toàn bộ data của master về slave ngay lập tức và tái lập replication bắt đầu tại thời điểm chuyển toàn… Read More

0 comments:

Post a Comment