cannot install mysql-server in ubuntu16.0.4
Solution 1
I solved this problem by removing mariadb's deb sources and purging mysql-common and then reinstalling it.
do:
sudo apt edit-sources
and look for anything containing mariadb like: deb [arch=amd64,arm64,ppc64el] http://ftp.nluug.nl/db/mariadb/repo/10.3/ubuntu bionic main
comment it out by putting a #
in front of it.
then run
sudo apt update
sudo apt purge mysql-common
sudo apt install mysql-common
after that you can install mysql-server properly via sudo apt install mysql-server
if it ever dissapears from the repo the script was:
#!/bin/sh
set -e
case "$1" in
install)
variant="$2"
my_cnf_path="$3"
update-alternatives --install /etc/mysql/my.cnf my.cnf "$my_cnf_path" 200
;;
remove)
variant="$2"
my_cnf_path="$3"
update-alternatives --remove my.cnf "$my_cnf_path"
;;
esac
```
Solution 2
Just purge all mysql packages and reinstall:
sudo apt-get remove --purge *mysql*
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get install mysql-server mysql_secure_installation
Solution 3
I fixed the problem by adding a blank file that the install script was looking for and then giving rwx permissions for everyone. Probably not the best way but it worked for me.
sudo touch /usr/share/mysql-common/configure-symlinks
sudo chmod 777 /usr/share/mysql-common/configure-symlinks
sudo apt-get update
sudo apt-get upgrade
Related videos on Youtube
doUWannaBuildASnowMan
Updated on September 18, 2022Comments
-
doUWannaBuildASnowMan over 1 year
sudo apt-get install mysql-server
fail it blocks at this pointvar/lib/dpkg/info/mysql-server-5.7.postinst: line 143: /usr/share/mysql-common/configure-symlinks: No such file or directory
which I found the solution to this bug is comment the line 143 in the /var/lib/dpkg/info/mysql-server-5.7.postinst file.
but my problem is I cannot find the /var/lib/dpkg/info/mysql-server-5.7.postinst file .. not to say comment one line in it .
so how to do to get rid of stuck situation
ps: I have installed mariadb and uninstall it by the steps I googled
update:
I have followed the steps given by the first answer, and it still prompted that error before
surprisingly, this time I can
sudo vim /var/lib/dpkg/info/mysql-server-5.7.postinst file
and I comment the line 143 , however.. it report another errorERROR: Unable to start MySQL server: 2017-11-26T08:51:57.033255Z 0 [Note] mysqld (mysqld 5.7.20-0ubuntu0.16.04.1-log) starting as process 22612 ... 2017-11-26T08:51:57.034651Z 0 [ERROR] You have enabled the binary log, but you haven't provided the mandatory server-id. Please refer to the proper server start-up parameters documentation 2017-11-26T08:51:57.035603Z 0 [ERROR] Aborting
-
Yaron over 6 yearsif you'll edit your answer and add some information to the set of commands you publish as answer, will improve its quality.
-
doUWannaBuildASnowMan over 6 years@e200 no ..it doesn't work. it still prompt this error
/var/lib/dpkg/info/mysql-server-5.7.postinst: line 143: /usr/share/mysql-common/configure-symlinks: No such file or directory
-
Andrew Bainbridge over 6 years@e200: I had a different failure installing mysql-server. And your advice fixed it. The error was, "Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'".
-
Eleandro Duzentos over 6 years@AndrewBainbridge Sometimes this happens when you clean up your logs.
-
Eleandro Duzentos over 6 yearsIf my answer helps you, you can upvote it. ;)
-
Andrew Bainbridge over 6 years@e200 - I can't upvote your answer since I don't know that it answers the original question! I've upvoted your comment instead :-)
-
userabuser almost 5 yearsOMFG... Finally. If you've been dancing with Maria and want to switch back to MySQL & have persistent
Package mysql-server-5.* is not configured yet
errors or any combination there of make sure to remove her source. Thanks. -
Akhil Surapuram almost 5 years@bigibas123 thanks for your answer. it really helped.
-
dgo over 4 yearsFinally! I've tried several other methods, but this was the first one that did it. Thanks!
-
Liso almost 4 yearsFirst time knowing
edit-sources
, seriously helpful +1. -
xaa almost 4 yearsohh I was blocked for a long time with the dpkg mysql-server-5.7 error on WSL. I think ´apt remove --purge *mysql*´ made the difference. apt will also remove other xxx-mysql packages (as using * before mysql in the command). I was worry about that but this is the solution !! thank you.
-
cosmicraga over 3 yearsWorked even in Ubuntu 20.04 and after trying for an hour all other methods which all failed. Thanks.