Solution 1:

I had the same problem. And here are the steps I took to solve it. From another ssh/terminal.

Stop apt & remove lock

sudo killall apt
sudo killall apt-get

sudo rm /var/lib/apt/lists/lock
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock*

sudo dpkg --configure -a

Purge mysql/mariadb packages

sudo apt-get purge mysql* mariadb* -y
sudo apt-get autoremove
sudo apt-get autoclean

Stop AppArmor

sudo systemctl stop apparmor.service
sudo update-rc.d -f apparmor remove

# OR/AND
sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/
sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld 

Check if all packages are OK

dpkg --configure -a

Reboot Important

systemctl reboot 

Install mraiadb-server

sudo apt-get install mariadb-server

Turn on AppArmor

sudo systemctl start apparmor.service
sudo update-rc.d apparmor defaults

# OR/AND
sudo rm /etc/apparmor.d/disable/usr.sbin.mysqld

Done.

I hope it will work for you too.