Installing MySQL Client 5.6 on Ubuntu 18.04 - mysql-connector

I have a legacy project that I'm trying to modernize, and part of that involves setting up a more efficient system of automated backups using mysqldump.
The app's database is using MySQL 5.6, and is hosted via an RDS instance. To get mysqldump up and running, I believe I need to install a version of mysql-client that corresponds to 5.6.
However, running apt-get install mysql-client installs 8.0 by default. However, I can't find any version-specific versions of mysql-client available. Running sudo apt-get install mysql-client-5.7 returns a notice that there's no installation candidate available.
Is it still possible to install older versions of mysql-client? If not, is there another way to get ahold of the mysqldump functionality?
Edit: As #exussum noted below, 8.0 is backwards compatible with 5.6 and 5.7. I was hitting errors when running mysqldump, which I'd assumed indicated incompatibility, but were actually related to my app specifically.

They are backwards compatible, so you can use mysql-client 8 to dump mysql-server 5.5
to get a specific version docker is great
(sudo apt install docker) to install
docker run mysql:5.6 mysqldump
will run mysqldump though docker, and you can choose your version there easily enough

Related

Mongodb Version mismatch Issue 3.6 to 4.0 upgrade

I have installed the latest version of MongoDB i.e 4.0.10. I am using Ubuntu 18.04.
When i run mongod --version in putty command line i get version 4.0.10
But When i run query in Studio3T db.version(); i get version 3.6.3
I ran dpkg -l | grep mongo and got following output.
Please help me in identifying what i am doing wrong here.
Looks like you have two MongoDBs installed, judging from 3.6.3-0ubuntu1 installed by apt, and 4.0.10 versions there.
The page Install MongoDB Community Edition on Ubuntu stated:
The mongodb package provided by Ubuntu is not maintained by MongoDB Inc. and conflicts with the mongodb-org package. To check if Ubuntu’s mongodb package is installed on the system, run sudo apt list --installed | grep mongodb. You can use sudo apt remove mongodb and sudo apt purge mongodb to remove and purge the mongodb package before attempting this procedure.
The older 3.6.3 appears to be still running in port 27017, thus that was the one connected to by Studio3T.
To ensure a clean installation, it's better to do a clean install by:
Follow the instructions in Uninstall MongoDB Community Edition
Remove 3.6.3 using apt as per the instruction above
Reinstall using the procedure in Install MongoDB Community Edition on Ubuntu.
It's probably not required to uninstall/reinstall everything again, but you don't want to have conflicting leftover files that will create problems down the road.
If you need the data in the old 3.6.3, please do mongodump before uninstalling it. You can subsequently restore it later.

PostgreSQL 9.6.9 on Alpine Linux (arm32v6) in Docker container - how to install correct postgresql-contrib package?

I need to install PostgreSQL 9.6.9 with uuid-ossp support in a Docker container on a 32-bit ARM system (its a QNAP NAS, CPU: Annapurna Labs Alpine AL-314).
I found the arm32v6/postgres images and installed arm32v6/postgres:9.6.9-alpine. This is working smoothly, but lacks the postgresql-contrib package. As far as I understand, I need to install postgresql-contrib to get uuid-ossp support.
I opened a CLI in the container and tried:
# apk update
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/armhf/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/armhf/APKINDEX.tar.gz
v3.7.0-215-g16971064c0 [http://dl-cdn.alpinelinux.org/alpine/v3.7/main]
v3.7.0-207-gac61833f9b [http://dl-cdn.alpinelinux.org/alpine/v3.7/community]
OK: 8879 distinct packages available
# apk add postgresql-contrib=9.6.9-r0
ERROR: unsatisfiable constraints:
postgresql-contrib-10.4-r0:
breaks: world[postgresql-contrib=9.6.9-r0]
How can I install the correct version of postgresql-contrib? Or can I just use postgresql-contrib-10.4-r0 with PostgreSQL 9.6.9?
Just use base alpine image and install PostgreSQL completely from Alpine's official packages: postgresql and postgresql-contrib. The last stable Alpine providing PostgreSQL 9.6 is v3.6, which is two versions behind, but still supported. Alpine v3.7 provides only 10.4.
Also don't specify exact version to apk add. Alpine provides only single version of the package per branch (e.g. v3.7, v3.8, edge). Once we release postgresql-contrib 9.6.9-r1 or 9.6.10-r0 (e.g. fixing some security issue), 9.6.9-r0 will not be available anymore and your apk add postgresql-contrib=9.6.9-r0 will fail.
These specialized Docker images “packaging” something that is already properly packaged in Alpine are mostly totally useless and just causes confusions and problems. I can't even count how many times I'm responding to this type of issue on SO.
I found out that the arm32v6/postgres:9.6.9-alpine Docker image does have uuid-ossp support out of the box. The image seems to be compiled with (some?) postgres-contrib modules. A look into the Dockerfile might help.

How to upgrade MySQL in a Bitnami Moodle stack?

I have a Bitnami Moodle stack I use for local development. When I upgraded the Moodle version to 2.8.1, which is the current production version, the Moodle install page says I need to upgrade from MySQL 5.5.21 to 5.5.31.
Is there a way to simply upgrade MySQL within the existing Bitnami Moodle Stack?
Bitnami developer here,
Bitnami stacks contain everything you need to run the application. That way, all of the Bitnami-packaged applications you want to run will share a single instance of Apache, MySQL, PHP, etc which will save space and improve performance.
The best way to upgrade all Moodle Stack components (PHP, MySQL, Apache…) it's explained in the link below:
https://wiki.bitnami.com/Applications/BitNami_Moodle#How_to_migrate_your_Moodle_installation.3f
It is strongly recommended that you create a backup before starting the update process. If you have important data, it is advisable that you create and try to restore a backup to ensure that everything works properly.
I hope it helps
I haven't used bitnami but just been reading the FAQs, it looks like you can use ssh to open a terminal
https://wiki.bitnami.com/BitNami_Cloud_Hosting/Servers/SSH
Assuming its Ubuntu, you could try updating Ubuntu first to see if it updates mysql.
ssh username#yourbitnami.com
sudo apt-get update
sudo apt-get upgrade
If that doesn't work then you can use the mysql 5.5 ppa from Ondrej to upgade to the latest version of mysql 5.5 - something like this:
ssh username#yourbitnami.com
sudo add-apt-repository ppa:ondrej/mysql-5.5
sudo apt-get update
sudo apt-get install mysql-server

Fail to build pg gem

I have:
Ubuntu 11.10
Postgres 8.4
libpq-dev, build-essential installed
ruby 1.9.2 and rails 3.2.1 install via rvm
However, pg gem fails to build, saying that:
checking for pg_config... yes
Using config values from /usr/lib/postgresql/8.4/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)
*** extconf.rb failed ***
I understant that this problem was asked dozen of times, but I googled like 2 days, and tried all the solutions I encoutered, and still this gem fails to build.
Any ideas?
Today I encountered a very similar problem on an Ubuntu 10.04.
After trying to get the pg installed for half a day, I decided to just install a more recent version of postgresql manually - which solved the problem for me.
Here is what I did:
1) Obtain the postgresql sources from their website. Since I deploy my rails applications to heroku and they say that they use version 9.0 of postgresql atm, I downloaded
http://ftp.postgresql.org/pub/source/v9.0.6/postgresql-9.0.6.tar.gz
2) Unpack, then follow the instructions in the INSTALL file. Note that 'su' is to be replaced by 'sudo su' in Ubuntu. After that, you have a postgresql server installed at /usr/local/pgsql/.
3) If you already had a system user named 'postgres', you might want to change its home directory to the new postgres installation. And you might want to add /usr/local/pgsql/bin to your PATH. Maybe uninstalling the postgresql-8.4 through apt-get before installing the 9.0 version from sources would be a good idea, I did not try that.
hth

Upgrade Postgresql 8.3 database file to 8.4

I upgraded my Ubuntu 8.04 To Ubuntu 10.04. Unfortunately, the upgrade process also updated the Postgres 8.3 install to a Postgres 8.4 install. My feeling is that although database engine binaries have been updated, the database itself was not migrated, hence it can not be loaded by the 8.4.
Since the 8.3 data format is not compatible with 8.4 format, altering postgresql.conf is not enough, nor can I use pg_dump with my 8.4 install.
I need a way to upgrade my previous base from 8.3 to 8.4, with no access to a 8.3 engine, only a 8.4.
Any clue?
The postgres packages in Debian, and hence, Ubuntu, has a very clearly defined way of upgrading from one Postgres version to another. The procedure is documented in /usr/share/doc/postgresql-common/README.Debian as follows:
Default clusters and upgrading
------------------------------
When installing a postgresql-X.Y package from scratch, a default
cluster 'main' will automatically be created. This operation is
equivalent to doing 'pg_createcluster X.Y main --start'.
Due to this default cluster, an immediate attempt to upgrade an
earlier 'main' cluster to a new version will fail and you need to
remove the newer default cluster first. E. g., if you have
postgresql-8.2 installed and want to upgrade to 8.3, you first install
postgresql-8.3:
apt-get install postgresql-8.3
Then drop the default 8.3 cluster:
pg_dropcluster 8.3 main --stop
And then upgrade the 8.2 cluster to 8.3:
pg_upgradecluster 8.2 main
The best time to do this is before ugrading to a version of Ubuntu where the version of Postgresql you're currently running has been removed, i.e. in this example, while on a version of Ubuntu that has the possibility to install both Postgres 8.3 and Postgres 8.4. In my case, I went from jaunty to karmic, upgraded 8.3 to 8.4 and then went from karmic to lucid.
The upgrade process as described above is very smooth. The *pg_upgradecluster* command will stop the old version, migrate data, then start the new version on the same port as the old version, finally starting the old version on a new port.
If you did not migrate your 8.3 postgres data before moving to an Ubuntu version that lacks postgres 8.3, migrating is still simple. Start by adding the karmic ubuntu repository to /etc/apt/sources.list:
deb http://archive.ubuntu.com/ubuntu/ karmic main restricted universe
Install postgresql-8.3:
apt-get update && apt-get install postgresql-8.3
Drop your 8.4 cluster. Warning: This will remove data in your postgresql 8.4 installation if you have any. But if you're only doing this because you need to upgrade your 8.3 to 8.4, you will have no data in your 8.4 cluster.
pg_dropcluster 8.4 main --stop
And then upgrade the 8.3 cluster to 8.4:
pg_upgradecluster 8.3 main
Finally, remove the postgresql-8.3 package, and remove the jaunty-line from /etc/apt/sources.list, then run apt-get update again.
As usual, taking a backup of your postgres directories before doing any of the above is always a good idea.
You'll have to install PostgreSQL 8.3 in temporary location from source, copy your old data there, start Pg, dump it's data using pd_dumpall and then import this data to new Postgres.
It's impossible without installing Pg 8.3.
Make sure you backup everything before you try anything.
There is the pg_migrator project which I think will do that for you, though I'm not sure whether it needs to 8.3 applications or source code.