Check existing mysql version:
# yum info mysql Available Packages Name : mysql Arch : x86_64 Version : 5.1.71 Release : 1.el6 Size : 893 k Repo : base Summary : MySQL client programs and shared libraries URL : http://www.mysql.com License : GPLv2 with exceptions Description : MySQL is a multi-user, multi-threaded SQL database server. MySQL is a : client/server implementation consisting of a server daemon (mysqld) : and many different client programs and libraries. The base package : contains the standard MySQL client programs and generic MySQL files.
So in default repository, the MySQL version is 5.1.71.
Let's Add extra repository:
There are a few popular repository for CentOS like bellow.
- epel - Extra Packages for Enterprise Linux, epel is a Fedora Special Interest Group that creates, maintains and manages a high quality set of additional packages for Enterprise Linux.
- remi - The Remi repository is a repository containing updated PHP and MySQL packages and is maintained by Remi.
- rpmforge - RepoForge is the new RPMforge. The RepoForge project maintains RPM packages for Red Hat Enterprise Linux (RHEL), CentOS and Scientific Linux.
Install epel, remi and rpmforge:
# rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm # rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm # rpm -Uvh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
Check repository:
# yum repolist repo id repo name status base CentOS-6 - Base 6,367 cloudera-manager Cloudera Manager, Version 4.8.0 6 epel Extra Packages for Enterprise Linux 6 - x86_64 10,440 extras CentOS-6 - Extras 14 rpmforge RHEL 6 - RPMforge.net - dag 4,650 updates CentOS-6 - Updates 463
Enable repository:
# vi /etc/yum.repos.d/epel.repo # vi /etc/yum.repos.d/remi.repo # vi /etc/yum.repos.d/rpmforge.repo change enabled=0 to enabled=1
Now check MySQL version again:
# yum --enablerepo=epel,remi,rpmforge info mysql Available Packages Name : mysql Arch : x86_64 Version : 5.5.36 Release : 1.el6.remi Size : 5.8 M Repo : remi Summary : MySQL client programs and shared libraries URL : http://www.mysql.com License : GPLv2 with exceptions and LGPLv2 and BSD Description : MySQL is a multi-user, multi-threaded SQL database server. MySQL is a : client/server implementation consisting of a server daemon (mysqld) : and many different client programs and libraries. The base package : contains the standard MySQL client programs and generic MySQL files.
Install MySQL 5.5.36:
# yum --enablerepo=epel,remi,rpmforge install mysql-server mysql-devel
Start mysql service:
# service mysqld start Initializing MySQL database: Installing MySQL system tables... OK Filling help tables... OK To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! To do so, start the server, then issue the following commands: /usr/bin/mysqladmin -u root password 'new-password' /usr/bin/mysqladmin -u root -h rtlnn2.retailigence.com password 'new-password' Alternatively you can run: /usr/bin/mysql_secure_installation which will also give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers. See the manual for more instructions. You can start the MySQL daemon with: cd /usr ; /usr/bin/mysqld_safe & You can test the MySQL daemon with mysql-test-run.pl cd /usr/mysql-test ; perl mysql-test-run.pl Please report any problems at http://bugs.mysql.com/ [ OK ] Starting mysqld: [ OK ]
Set password for root:
# mysql_secure_installation NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MySQL to secure it, we'll need the current password for the root user. If you've just installed MySQL, and you haven't set the root password yet, the password will be blank, so you should just press enter here. Enter current password for root (enter for none): OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MySQL root user without the proper authorisation. Set root password? [Y/n] Y New password: Re-enter new password: Password updated successfully! Reloading privilege tables.. ... Success! Remove anonymous users? [Y/n] Y ... Success! Disallow root login remotely? [Y/n] Y ... Success! Remove test database and access to it? [Y/n] n ... skipping. Reload privilege tables now? [Y/n] Y ... Success! Cleaning up... All done!
Test mysql:
# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 8 Server version: 5.5.36 MySQL Community Server (GPL) by Remi Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> exit
Configure mysql process to start at system boot time:
# chkconfig --list | grep mysqld mysqld 0:off 1:off 2:off 3:off 4:off 5:off 6:off # chkconfig --level 345 mysqld on # chkconfig --list | grep mysqld mysqld 0:off 1:off 2:off 3:on 4:on 5:on 6:off
You are all set.
3 comments:
Hi! and thanks for a great guide. What happens to my existing settings and databases? I've made a sqldump for all databases and made a backup of my.cnf. Should I be considered something else?
Hi Ulf:
I would also backup all directories/paths defined in my.cnf, for example "/var/lib/mysql". Normally "my.cnf" and a full mysql dump will be sufficient but it doesn't hurt to backup extra paths.
My upgrade worked without problems! (of course with the yum -update syntax instead of -install).
Post a Comment