As long as you are dealing with two GA releases in the same series (5.6.y to 5.6.x), you should be okay, because that is not an unsupported operation.
To downgrade between General Availability (GA) status versions within the same release series, typically you just install the new binaries on top of the old ones and do not make any changes to the databases.
https://dev.mysql.com/doc/refman/5.6/en/downgrading.html
Or, better (I think) than just copying the new (old version) binaries over the old (new version), use the mechanism I use, where /usr/local/mysql
is a symlink to the directory where the live version binaries are extracted, and data
, inside that directory, is a symlink to the datadir.
This is a perfectly valid configuration and it allows both sets of binaries coexist on the same machine. I use the "Linux generic" binary tarball, which extracts the files into a directory named after the release and OS... as a DBA, I don't let the distro's package manager anywhere near my MySQL. Nobody decides when we upgrade or what version we run, other than me, so upgrades occur when planned and after testing.
With this setup, it's a quick operation to stop the service, move one symlink, and start the service, and I'm running the new version... and similarly quick to switch it back, if you have to. I still do it exactly this way, though I am a lot less edgy about the possibility of needing to roll back.
You also need to run mysql_upgrade
to finalize the upgrade process, but you don't typically have to do it immediately, during a GA to GA release upgrade. You can do it after the server is back up, and, in fact, the server has to be running before you can do that part.
Of course, during any upgrade, it's critical to have a mysqldump
of your data ready to reload in an emergency... but within the same release series, with GA versions, you should be able to pull this off... but also, you shouldn't need to. The biggest jump I recall doing in one shot was 5.1.34 to 5.1.69, with no ill effects, and of the dozens of machines I manage, I don't recall a 5.5 or 5.6 upgrade that I had any reason to roll back.
Another suggestion for before you upgrade is to sweep the entire server for cobwebs with mysqlcheck --check-upgrade --all-databases
which confirms that the tables are fully structurally compatible with the current version you're running... and then mysqlcheck --optimize --all-databases
. The latter is recommended (by me) not because of what it does, but because it's likely to find sketchy structural issues that could cause problems that appear to be upgrade-related, but were in fact latent corruption just waiting to surface. Optimize is time-consuming and will lock each table while running, then unlock it and move to the next, so it's potentially disruptive, but with InnoDB, it also defragments each table, so you might reclaim some disk space in the process. Skip the optimize if you can't tolerate the potentially long locks it needs while it's running.
The issue has been solved by:
removing the -c
option from the gcc command line and adding the -fPIC
option at the end, turning the command line into:
gcc -Wall -I/usr/local/include -shared -o libcompress_sequence.so compress_sequence.c -fPIC
The -c
option removed the linking, which is not wished here since the library is compiled in one step. So removing the -c
option tells to gcc to make the linking with the libraries included in the C file. But then gcc didn't compile anymore, and complained about the option -fPIC
missing. I added it and gcc compiled.
Then MySQL complained about not being able to detect the function COMPRESS_PROTEIN_SEQUENCE
in my library. So I put it in small letters: compress_protein_sequence
, as the function is named into my C code, then MySQL imported the library. The actual MySQL command is the following:
CREATE FUNCTION compress_protein_sequence RETURNS STRING SONAME 'libcompress_sequence.so';
I am now able to use the MySQL function COMPRESS_PROTEIN_SEQUENCE
.
Best Answer
You can use the IF() function, VERSION() function and Dynamic SQL:
I used the left 3 character of the VERSION() to get the major release. Why ?
LEFT(VERSION(),3)
returns5.7
or more,@dynamic_func_name
will beST_GeomFromText
LEFT(VERSION(),3)
returns5.6
or less,@dynamic_func_name
will beGeomFromText