Whenever i try to install anything, it always install mysql-server-5.7.

I tried sudo apt-get install php-mbstring but it tried to install mysql-server-5.7 first. I don't know what is going wrong.

I am getting following errors

Reading package lists... Done
Building dependency tree       
Reading state information... Done
php-mbstring is already the newest version (1:7.0+35ubuntu6).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? \[Y/n\] y
Setting up mysql-server-5.7 (5.7.13-0ubuntu0.16.04.2) ...
Renaming removed key_buffer and myisam-recover options (if present)
dpkg: error processing package mysql-server-5.7 (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-server-5.7; however:
  Package mysql-server-5.7 is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)]

Here is the attached image

  • The problem here is, you installed (or someone else) mysql-server-5.7 and it didn't cleanly installed. Either because of some dependency problem or other. As a result, whenever you want to install another package, apt tries to complete the earlier installation. From your posted messages, I see that it is caused by a dependency problem. Using sudo apt-get -f install should get you out of the problem. If not edit the question to include what goes wrong. – Anwar Aug 11 '16 at 10:49

I had had the same problem. In my case, it reveals that for some reasons I had the mysql-server running with sock file places in /tmp/something/ (maybe it was started by the dpkg, cause I dont have mysql enabled at startup?). I killed the mysqlserver (kill -9) and stared the mysql service just normal (service mysql start).

Then I run sudo dpkg --configure -a. While updating the script throw an error about to low "thread_stack" which was easy to change in mysqld.cnf (/etc/mysql). Restarted the mysql service, run dpkg --configure -a once again and voila - the upgrade went ok.

OS: Ubuntu16.04.1

| improve this answer | |
  • I found success after I checked ps -aef | grep mysql and sent a kill signal to all varieties of running mysqld. – Charney Kaye Jan 11 '17 at 20:11

I had a similar problem:

Dpkg: package error processing mysql-server (--configure): Dependency problems - leaving unconfigured Errors were Encountered while processing: mysql-server mysql-server-5.7

So I did as advised:

     sudo dpkg --configure mysql-server-5.7

And then I noticed:

Mysql_upgrade: Got error: 1045: Access denied for user 'Debian-sys-maint' @ 'localhost' (using password: YES) while connecting To the MySQL server

So, I only needed to add the rights for Debian-sys-maint user.

A blog post explains very well the details of the reasoning and approach (in French) : http://www.linuxaddict.fr/index.php/2013/12/24/comment-regler-lerreur-dacces-de-debian-sys-maint-dans-mysql/

To summerize it :

  • Edit /etc/mysql/my.cnf and uncomment theise lines or add them to enable mysql loging in order to understant what happened :
general_log_file = /var/log/mysql/mysql.log
general_log = 1
  • Restart mysql service :
sudo /etc/init.d/mysql reload
  • Then I had that error (Access denied to the user) :

error: 'Access denied for user 'debian-sys-maint'@'localhost' (using password: YES)'

  • So, note the password in the file /etc/mysql/debian.cnf and grant privilege to that user :

mysql -u root -p
mysql>GRANT ALL PRIVILEGES ON . TO 'debian-sys-maint'@'localhost' IDENTIFIED BY 'Your password';


  • Restart mysql and try again your installation :

sudo /etc/init.d/mysql restart

| improve this answer | |
  • 4
    Please post only in English as this is an English speaking website and many of our members won't understand French. Translating services like translate.google.com can help you. It's not a problem if you're unable to write in perfect English, we can edit and fix little mistakes once we are able to understand what you want to say. Thanks for understanding and welcome to Ask Ubuntu. Please also make sure to have read the little tour. – Byte Commander Aug 11 '16 at 11:04
  • Hi, I'm sorry, I didn't even notice that the website was in English, sorry. I don't really think that I need Google translate and it's not really cool to post auto-translated content neither. I'll take care about that next time. – Gweltaz Niquel Aug 12 '16 at 16:28
  • Whats the solution for the same – Sushivam Oct 19 '16 at 9:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.