I need to install mariadb 5.5 because I have old databases that wouldn't work with mariadb 10 and cause mysql to crash! I tried adding this repo but no luck

sudo sh -c 'echo "deb http://ftp.osuosl.org/pub/mariadb/repo/5.5/ubuntu trusty main" >> /etc/apt/sources.list.d/mariadb.list'

Do you know how to do it?

I tried searching after adding the repo, here's what I got

sudo apt search mariadb-server

mariadb-server/focal,focal 1:10.3.22-1ubuntu1 all
  MariaDB database server (metapackage depending on the latest version)

mariadb-server-10.3/focal,now 1:10.3.22-1ubuntu1 amd64 [residual-config]
  MariaDB database server binaries

mariadb-server-core-10.3/focal 1:10.3.22-1ubuntu1 amd64
  MariaDB database core server files
  • Did you mean sudo su -c instead of sudo sh -c?
    – Daniel M.
    Jun 11, 2020 at 12:19
  • I copied it like that! I tried your suggestion but when I sudo apt search mariadb-server I don't get version 5
    – unloco
    Jun 11, 2020 at 12:23
  • 1
    By default apt will use the latest version of the package from whichever repo the latest version is in. If you want version 5 you'll have to specify it on the command-line with sudo apt install mariadb-server=<version> (replace <version> with the version you want). Might be hard to find especially since Ubuntu usually appends stuff to the end of the release numbers.
    – Daniel M.
    Jun 11, 2020 at 12:29

1 Answer 1


Try this.

sudo sh -c "echo 'deb http://ftp.osuosl.org/pub/mariadb/repo/5.5/ubuntu trusty main' >> /etc/apt/sources.list.d/mariadb.list"

As opposed of that, you can feed the input to tee rather than echo directly to the file.

echo "deb http://ftp.osuosl.org/pub/mariadb/repo/5.5/ubuntu trusty main" | sudo tee -a /etc/apt/sources.list.d/mariadb.list

I think it's more cleaner and give you the output, but if you would like to surpress it— you can always append > /dev/null to the end.

The command did same thing as adding repository via add-apt-repository, so to preserve the change you have to update the index as well.

sudo apt update

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .