I have upgraded server from centos to ubuntu 22.04, but I want to keep mysql 5.7.
I use ansible for provisioning
By default ubuntu 22.04 apt gives mysql 8, so I think I need to add repo, gpg keyring manually and only then install.
However I don't see ubuntu 22.04 mysql 5,7 source here https://dev.mysql.com/downloads/mysql/5.7.html?os=src
So I guess I need some not ubuntu specific source: Linux – Generic (glibc 2.12) (x86, 32-bit), TAR maybe?
How I should install it, code below will not work because it's not deb package, it needs to be extracted and installed manually from tar.gz, and I don't know how, I keep getting html instead of tar.gz downloaded?
- name: Install Mysql GPG key
become: true
shell: "wget -qO - https://dev.mysql.com/downloads/gpg/?file=mysql-5.7.39-linux-glibc2.12-x86_64.tar.gz&p=23 | gpg --dearmor -o /usr/share/keyrings/mysql-keyring.gpg"
args:
creates: "/usr/share/keyrings/mysql-keyring.gpg"
- name: Add Mysql deb repository
shell: echo "deb [signed-by=/usr/share/keyrings/mysql-keyring.gpg] https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.39-linux-glibc2.12-x86_64.tar.gz stable main" | sudo tee /etc/apt/sources.list.d/mysql-5.7.39.list
args:
creates: "/etc/apt/sources.list.d/mysql-5.7.39.list"
notify: reload apt
- name: Install MySQL Server
apt:
name: mysql-server
state: present
- name: Start and enable MySQL
systemd:
name: mysql
state: started
enabled: yes
But it's just my thoughts, probably there's better way, my only goal is mysql 5.7 on ubuntu 22.04
Best Answer
Made it!
Thanks to Ramhound suggesting trying 18.04 ubuntu version of mysql
But in addition I had to manually install
mysql-community-client
andmysql-client
dependencies because they tried to install incompatible 8.0 versions.Update:
to avoid installing dependencies you can pin version to server like