Difference between revisions of "Mysql57"
Unnilennium (talk | contribs) |
Unnilennium (talk | contribs) |
||
(35 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
− | {{ | + | <blockquote style="float: right;"> |
+ | [[File:softwarecollections.png|100px]] | ||
+ | </blockquote> | ||
+ | <blockquote style="float: right;"> | ||
+ | [[File:Mysql.png]] | ||
+ | </blockquote> | ||
+ | __TOC__ | ||
+ | {{Note box| Mysql 5.7 support is up to 31 Oct 2023 so 8 months before SME10 EOL which is 30 June 2024.}} | ||
+ | == Description == | ||
− | + | This contrib purpose is to help configuring mysql57 on SME9 and above using software collection. | |
− | This contrib | + | This RPM will allow you to have 2 or more (if also using another contrib for another sclo version) versions of MySQL running side by side. You will have to select the one to use in the setup of the specific application - please see "usage" below. Please note that applications and contribs like phpmyadmin etc. will as standard use the original Mysql DBM for your OS unless you change the database connection to Mysql 5.7. |
Most of configuration options are explained for mysql here : [[MySQL]] are also available for mysql57 ( except innoDB options). Only difference is to prefix mysqld and mysql.init db entry by "mysql57-". | Most of configuration options are explained for mysql here : [[MySQL]] are also available for mysql57 ( except innoDB options). Only difference is to prefix mysqld and mysql.init db entry by "mysql57-". | ||
Line 9: | Line 17: | ||
Note that default behaviour will be socket only, and if you enable networking, it will listen on 3309 locally. You then will need to open port to 3309 to access remotely. Also if you want another port you need to define mysql57-mysqld property port to whatever you want. Also remember that default mysql port is reserved to original mysql server | Note that default behaviour will be socket only, and if you enable networking, it will listen on 3309 locally. You then will need to open port to 3309 to access remotely. Also if you want another port you need to define mysql57-mysqld property port to whatever you want. Also remember that default mysql port is reserved to original mysql server | ||
− | |||
− | + | See also for reference: [[Software_Collections:MySQL]] | |
For SME9 Software collection is only available for x64 architectures. | For SME9 Software collection is only available for x64 architectures. | ||
=== Version === | === Version === | ||
− | {{ #smeversion: smeserver-mysql57}} | + | {{#smeversion: smeserver-mysql57}} |
=== Maintainer === | === Maintainer === | ||
− | [mailto:tests@pialasse.com[[User:Unnilennium|Unnilennium | + | [mailto:tests@pialasse.com][[User:Unnilennium|Unnilennium]] |
==Installation== | ==Installation== | ||
− | {{ | + | <tabs container><tab name="For SME 10"> |
+ | yum install smeserver-extrarepositories-centos-sclo -y | ||
+ | yum install --enablerepo=smecontribs,centos-sclo-rh smeserver-mysql57 | ||
+ | source /etc/profile.d/mysql57.sh | ||
+ | |||
+ | and enjoy mysql57, no more commands nor reboot required ! | ||
+ | </tab> | ||
+ | <tab name="For SME 9"> | ||
+ | yum install smeserver-extrarepositories-centos-sclo -y | ||
+ | signal-event yum-modify | ||
+ | |||
+ | {{warning box| You have to do the signal-event post-upgrade; signal-event reboot; or your mysql57 installation will remain in a definitive failed state. They are MANDATORY. }} | ||
+ | yum install --enablerepo=smecontribs,centos-sclo-rh smeserver-mysql57 | ||
+ | signal-event post-upgrade ; signal-event reboot | ||
− | + | {{warning box|Again, If you do not issue the previous two commands and try to start the service on your own you will end with a non functional mysql server, failed in the middle of its initialization with no way to return back except by deinstalling it all and manually remove all (absolutely all) created files by the failed initialization }} | |
− | signal-event post-upgrade | + | NB : starting from SME 9.2 and smeserver-yum-2.4.0-15.el6.sme.noarch.rpm installed you will be able to install this scl version of mysql57 simply doing the following, without enabling the rh scl repo : |
− | signal-event reboot | + | yum install --enablerepo=smecontribs smeserver-mysql57 |
+ | signal-event post-upgrade ; signal-event reboot | ||
+ | </tab> | ||
+ | </tabs> | ||
== Usage == | == Usage == | ||
− | PHP | + | By default mysql57 uses a socket for connections. |
+ | |||
+ | PHP applications that are aware of sockets are few, and most typically try to connect to a port. You will have to craft a way to define the one you want to use for your particular app. Some let you put it in a variable, some will just need you to add it after the hostname or ip (localhost:3309), some will just assume 3306 and just ignore anything else. | ||
Possible host strings (localhost can be replaced with 127.0.0.1 if needed): | Possible host strings (localhost can be replaced with 127.0.0.1 if needed): | ||
Line 37: | Line 62: | ||
* localhost:/var/lib/mysql/mysql57.sock | * localhost:/var/lib/mysql/mysql57.sock | ||
* localhost;unix_socket=/var/lib/mysql/mysql57.sock | * localhost;unix_socket=/var/lib/mysql/mysql57.sock | ||
+ | |||
+ | PHP applications that are aware of sockets are few, and most of them will try to connect to a port. To enable mysql57 to use a port you will need to do the following: | ||
+ | |||
+ | config setprop mysql57-mysqld port 3309 LocalNetworkingOnly no | ||
+ | signal-event post-upgrade;signal-event reboot | ||
+ | |||
+ | mysq57 should now be listening on port 3309. you can check this using netstat: | ||
+ | |||
+ | netstat -atn |grep 3309 | ||
+ | |||
+ | Beware that some applications just assume the running port number, so to connect to mysql55 on 3307 instead of stock mysql on 3306 you will need to carefully investigate and modify your application accordingly e.g. | ||
+ | |||
* localhost:3309 | * localhost:3309 | ||
+ | |||
+ | {{Warning box|1=Note that you may experience issues with PHP connecting to the correct port if you use localhost. There is an obscure bug in PHP which means you will need to use 127.0.0.1 instead of localhost. Please see See bug https://bugs.contribs.org/show_bug.cgi?id=10616 for more information}} | ||
For Wordpress adjust the DB_HOST value in the wp-config.php file accordingly. | For Wordpress adjust the DB_HOST value in the wp-config.php file accordingly. | ||
Line 44: | Line 83: | ||
== command line == | == command line == | ||
+ | For your convenience, aliases have been added : mysql57, mysqlshow57, mysqladmin57, mysqldump57, mysqlimport57 and mysqlbinlog57 | ||
− | /opt/rh/rh-mysql57/root/usr/bin/mysql --socket=/var/lib/mysql/mysql57.sock | + | Assuming you have a wordpress database setup, the following will connect to database wordpress in mysql57 server, and present the mysql prompt so you can work with the database. |
+ | |||
+ | mysql57 wordpress | ||
+ | |||
+ | However the full command line to access, per instance to mysql55 server with the mysql client against its version would be : | ||
+ | |||
+ | mysql57 | ||
+ | |||
+ | Alternatively: | ||
+ | |||
+ | The complete path to the specific version of mysql57 server with the mysql client would be: | ||
+ | |||
+ | # /opt/rh/rh-mysql57/root/usr/bin/mysql --socket=/var/lib/mysql/mysql57.sock | ||
+ | |||
+ | or use TCP on port 3309: | ||
+ | |||
+ | PHP applications that are aware of sockets are few, and most of them will try to connect to a port. To enable mysql57 to use a port you will need to do the following | ||
+ | |||
+ | {{Note box|1=Note see usage details in https://wiki.contribs.org/Software_Collections:MySQL55}} | ||
+ | |||
+ | # config setprop mysql57-mysqld port 3309 LocalNetworkingOnly no | ||
+ | # config show mysql57-mysqld | ||
+ | # mysql57-mysqld=service | ||
+ | LocalNetworkingOnly=no | ||
+ | port=3309 | ||
+ | status=enabled | ||
+ | # signal-event post-upgrade; signal-event reboot | ||
+ | |||
+ | # /opt/rh/mysql57/root/usr/bin/mysql --protocol=TCP --port=3309 | ||
+ | |||
+ | Note that using the regular 5.1 client may work, but can lead to unexpected results. Please avoid this type of command invocation: | ||
+ | |||
+ | # mysql --socket=/var/lib/mysql/mysql57.sock | ||
== Resetting the MySQL root password == | == Resetting the MySQL root password == | ||
To reset the password for the MySQL root account. The MySQL root user on SME Server has a random generated password which is generated during installation. You do not need to know this password to login to MySQL with root privileges on SME Server. If you might have changed the MySQL root password you can reset it like this after getting command line access as root user. | To reset the password for the MySQL root account. The MySQL root user on SME Server has a random generated password which is generated during installation. You do not need to know this password to login to MySQL with root privileges on SME Server. If you might have changed the MySQL root password you can reset it like this after getting command line access as root user. | ||
+ | #SME9 | ||
service mysql57-mysqld stop | service mysql57-mysqld stop | ||
expand-template /root/.my.cnf | expand-template /root/.my.cnf | ||
expand-template /var/service/mysql57-mysqld/set.password | expand-template /var/service/mysql57-mysqld/set.password | ||
− | /opt/rh/mysql57/root/usr/libexec/mysqld --socket=/var/lib/mysql/mysql57.sock --bootstrap --user=mysql --skip-grant-tables < /var/service/mysql57-mysqld/set.password | + | scl enable rh-mysql57 bash |
+ | /opt/rh/rh-mysql57/root/usr/libexec/mysqld --socket=/var/lib/mysql/mysql57.sock --bootstrap --user=mysql --skip-grant-tables < /var/service/mysql57-mysqld/set.password | ||
+ | exit | ||
service mysql57-mysqld start | service mysql57-mysqld start | ||
+ | |||
+ | #SME10 | ||
+ | systemctl stop mysql57-mysqld | ||
+ | expand-template /root/.my.cnf | ||
+ | expand-template /var/opt/rh/rh-mysql57/lib/misc/set.password | ||
+ | scl enable rh-mysql57 bash | ||
+ | /opt/rh/rh-mysql57/root/usr/libexec/mysqld --socket=/var/lib/mysql/mysql57.sock --bootstrap --user=mysql --skip-grant-tables < /var/opt/rh/rh-mysql57/lib/misc/set.password | ||
+ | exit | ||
+ | systemctl start mysql57-mysqld | ||
=== Bugs === | === Bugs === | ||
Line 67: | Line 151: | ||
Only versions released in smecontrib are listed here: | Only versions released in smecontrib are listed here: | ||
− | {{ #smechangelog: smeserver-mysql57}} | + | {{#smechangelog: smeserver-mysql57}} |
− | |||
[[Category: Contrib]] | [[Category: Contrib]] | ||
[[Category: Software Collections]] | [[Category: Software Collections]] |
Latest revision as of 20:23, 19 March 2022
Description
This contrib purpose is to help configuring mysql57 on SME9 and above using software collection.
This RPM will allow you to have 2 or more (if also using another contrib for another sclo version) versions of MySQL running side by side. You will have to select the one to use in the setup of the specific application - please see "usage" below. Please note that applications and contribs like phpmyadmin etc. will as standard use the original Mysql DBM for your OS unless you change the database connection to Mysql 5.7.
Most of configuration options are explained for mysql here : MySQL are also available for mysql57 ( except innoDB options). Only difference is to prefix mysqld and mysql.init db entry by "mysql57-".
Note that default behaviour will be socket only, and if you enable networking, it will listen on 3309 locally. You then will need to open port to 3309 to access remotely. Also if you want another port you need to define mysql57-mysqld property port to whatever you want. Also remember that default mysql port is reserved to original mysql server
See also for reference: Software_Collections:MySQL
For SME9 Software collection is only available for x64 architectures.
Version
Maintainer
Installation
yum install smeserver-extrarepositories-centos-sclo -y yum install --enablerepo=smecontribs,centos-sclo-rh smeserver-mysql57 source /etc/profile.d/mysql57.sh
and enjoy mysql57, no more commands nor reboot required !
yum install smeserver-extrarepositories-centos-sclo -y signal-event yum-modify
yum install --enablerepo=smecontribs,centos-sclo-rh smeserver-mysql57 signal-event post-upgrade ; signal-event reboot
NB : starting from SME 9.2 and smeserver-yum-2.4.0-15.el6.sme.noarch.rpm installed you will be able to install this scl version of mysql57 simply doing the following, without enabling the rh scl repo :
yum install --enablerepo=smecontribs smeserver-mysql57 signal-event post-upgrade ; signal-event reboot
Usage
By default mysql57 uses a socket for connections.
PHP applications that are aware of sockets are few, and most typically try to connect to a port. You will have to craft a way to define the one you want to use for your particular app. Some let you put it in a variable, some will just need you to add it after the hostname or ip (localhost:3309), some will just assume 3306 and just ignore anything else.
Possible host strings (localhost can be replaced with 127.0.0.1 if needed):
- localhost:/var/lib/mysql/mysql57.sock
- localhost;unix_socket=/var/lib/mysql/mysql57.sock
PHP applications that are aware of sockets are few, and most of them will try to connect to a port. To enable mysql57 to use a port you will need to do the following:
config setprop mysql57-mysqld port 3309 LocalNetworkingOnly no signal-event post-upgrade;signal-event reboot
mysq57 should now be listening on port 3309. you can check this using netstat:
netstat -atn |grep 3309
Beware that some applications just assume the running port number, so to connect to mysql55 on 3307 instead of stock mysql on 3306 you will need to carefully investigate and modify your application accordingly e.g.
- localhost:3309
For Wordpress adjust the DB_HOST value in the wp-config.php file accordingly.
define( 'DB_HOST', 'localhost:/var/lib/mysql/mysql57.sock' );
command line
For your convenience, aliases have been added : mysql57, mysqlshow57, mysqladmin57, mysqldump57, mysqlimport57 and mysqlbinlog57
Assuming you have a wordpress database setup, the following will connect to database wordpress in mysql57 server, and present the mysql prompt so you can work with the database.
mysql57 wordpress
However the full command line to access, per instance to mysql55 server with the mysql client against its version would be :
mysql57
Alternatively:
The complete path to the specific version of mysql57 server with the mysql client would be:
# /opt/rh/rh-mysql57/root/usr/bin/mysql --socket=/var/lib/mysql/mysql57.sock
or use TCP on port 3309:
PHP applications that are aware of sockets are few, and most of them will try to connect to a port. To enable mysql57 to use a port you will need to do the following
# config setprop mysql57-mysqld port 3309 LocalNetworkingOnly no # config show mysql57-mysqld # mysql57-mysqld=service LocalNetworkingOnly=no port=3309 status=enabled # signal-event post-upgrade; signal-event reboot
# /opt/rh/mysql57/root/usr/bin/mysql --protocol=TCP --port=3309
Note that using the regular 5.1 client may work, but can lead to unexpected results. Please avoid this type of command invocation:
# mysql --socket=/var/lib/mysql/mysql57.sock
Resetting the MySQL root password
To reset the password for the MySQL root account. The MySQL root user on SME Server has a random generated password which is generated during installation. You do not need to know this password to login to MySQL with root privileges on SME Server. If you might have changed the MySQL root password you can reset it like this after getting command line access as root user.
#SME9 service mysql57-mysqld stop expand-template /root/.my.cnf expand-template /var/service/mysql57-mysqld/set.password scl enable rh-mysql57 bash /opt/rh/rh-mysql57/root/usr/libexec/mysqld --socket=/var/lib/mysql/mysql57.sock --bootstrap --user=mysql --skip-grant-tables < /var/service/mysql57-mysqld/set.password exit service mysql57-mysqld start
#SME10 systemctl stop mysql57-mysqld expand-template /root/.my.cnf expand-template /var/opt/rh/rh-mysql57/lib/misc/set.password scl enable rh-mysql57 bash /opt/rh/rh-mysql57/root/usr/libexec/mysqld --socket=/var/lib/mysql/mysql57.sock --bootstrap --user=mysql --skip-grant-tables < /var/opt/rh/rh-mysql57/lib/misc/set.password exit systemctl start mysql57-mysqld
Bugs
Please raise bugs under the SME-Contribs section in bugzilla and select the smeserver-mysql57 component or use this link .
Changelog
Only versions released in smecontrib are listed here:
- fix mysql.init and few other scripts [SME: 11896]
- expand phpmyadmin config file on install [SME: 11877]
2022/02/23 Jean-Philippe Pialasse 2.0.0-13.sme
- adapt for SME10 [SME: 11877]
systemd service fileschanging paths
update event
- fix reload dump when should not [SME: 10830]
- fix pre-backup failure [SME: 10202]