Difference between revisions of "Software Collections:MySQL"

From SME Server
Jump to navigationJump to search
Line 38: Line 38:
  
 
===Start/Stop MySQL===
 
===Start/Stop MySQL===
{{Note box|Before MySQL can be started, the socket file defined in ''/opt/rh/mysql55/root/etc/my.cnf'' has to be adjusted for it is the same as the default installation of MySQL. The correct 3rd line should read ''socket=/var/lib/mysql/mysql55.sock''.<br>
+
{{Note box|Before MySQL can be started, the socket file defined in /opt/rh/mysql55/root/etc/my.cnf has to be adjusted for it is the same as the default installation of MySQL. The correct 3rd line should read: ''' <nowiki>socket=/var/lib/mysql/mysql55.sock</nowiki>'''}}
How to connect to mysql55, for using 'mysql' will invoke the CLI of the standard MySQL version and not the scl version. Not even when trying to start /opt/rh/mysql55/bin/mysql, it will invoke the 'old' MySQL.}}  
+
 
 +
{{Note box|How to connect to mysql55, for using 'mysql' will invoke the CLI of the standard MySQL version and not the scl version. Not even when trying to start /opt/rh/mysql55/bin/mysql, it will invoke the 'old' MySQL.}}  
 
MySQL is now installed and can be started and stopped manually via:
 
MySQL is now installed and can be started and stopped manually via:
 
  /etc/rc.d/init.d/mysql55-mysqld start
 
  /etc/rc.d/init.d/mysql55-mysqld start

Revision as of 10:19, 7 January 2015

Warning.png Work in Progress:
This page is a Work in Progress. The contents off this page may be in flux, please have a look at this page history the to see list of changes.


Mysql.png

Installing and running MySQL via Software collections

Software Collections has been introduced by Redhat as a safe way to run selective applications on Redhat based distributions in an isolated environment (separate directory), thus not effecting the base installation of the OS. This provides the possibility to e.g. test an application, install a higher version then the version installed by the base system (e.g. PHP), or temporarily use an application.

Software Collections applications can be started at boot as a system service, manually or in a specific shell.

MySQL

Installation

To be able to install an application from the Software Collections, one must install software collections first. Please see Software collections on how to install this.


Required repository

After installing Software Collections, the scl repository for MySQL has to be added to the yum repositories. Please see here on how the enable the scl-mysql55 repository.


Install application

After installing the scl-mysql55 repository, MySQL can be installed by issuing the following command:

yum install mysql55 --enablrepo=scl-mysql55

Once installed, the application is installed on your SME Server at /opt/rh/mysql55- as an isolated environment for the application.

Only 1 service script has been installed on your base SME Server which is /etc/rc.d/init.d/mysql55-mysqld. This script will start and stop the installed application.


Test installed application

Once MySQL has been installed, you can check if it is correctly installed by issuing:

scl -l

which will provide you a listing of all applications that are available on your system installed via Software Collections.

A simple man page about the installed application is now available via:

scl enable mysql55 'man mysql55'

press 'q' to leave the man page


Start/Stop MySQL

Important.png Note:
Before MySQL can be started, the socket file defined in /opt/rh/mysql55/root/etc/my.cnf has to be adjusted for it is the same as the default installation of MySQL. The correct 3rd line should read: socket=/var/lib/mysql/mysql55.sock



Important.png Note:
How to connect to mysql55, for using 'mysql' will invoke the CLI of the standard MySQL version and not the scl version. Not even when trying to start /opt/rh/mysql55/bin/mysql, it will invoke the 'old' MySQL.


MySQL is now installed and can be started and stopped manually via:

/etc/rc.d/init.d/mysql55-mysqld start

and

/etc/rc.d/init.d/mysql55-mysqld stop


Start/Stop MySQL as a system service

Issue the following commands as root:

ln -s /etc/rc.d/init.d/e-smith-service /etc/rc7.d/S99mysql55-mysqld
chkconfig mysql55-mysqld on
config set mysql55-mysqld service
config setprop mysql55-mysqld status enabled

The application will now automatically start at boot time as a system service.


Configure private/public access

Important.png Note:
This part needs to revised due to port 3306 already in use by the default SME Server MySQL version. Maybe using the -p 13306 option when starting MySQL55.


If your SME Server is hosting the application and is being accessed by other hosts either locally (LAN) or remotely (WAN) the ports and access privileges need to be set. For this issue the following commands (where 5432 is the port that MySQL can be reached on):

config setprop mysql55-mysqld TCPPort 13306
config setprop mysql55-mysqld UDPPort 13306
config setprop mysql55-mysqld access private

followed by the event to update the firewall rules:

signal-event remoteaccess-update

You can toggle between private and public access followed by the remoteaccess-update command.

Other articles in this category

Mysql57, PHP Software Collections, Software Collections, Software Collections Repositories, Software Collections:MariaDB, Software Collections:MongoDB, Software Collections:MySQL, Software Collections:MySQL55, Software Collections:Nodejs, Software Collections:PHP, Software Collections:PostgreSQL, Software Collections:Python, Software Collections:Ruby on Rails