2

I upgraded to 18.04 from 16.04 and mysql instal failed.

The error I am getting is it can't create a directory /var/lib/mysql which was there, and if I remove it the install process re-creates this directory and then gives the error that ti can't create it. I have manualy removed all mysql files, and uninstall with apt-get and then retried, same error:

The following NEW packages will be installed:
  mysql-server
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 0 B/81.0 kB of archives.
After this operation, 91.1 kB of additional disk space will be used.
Selecting previously unselected package mysql-server.
(Reading database ... 283882 files and directories currently installed.)
Preparing to unpack .../mysql-server_8.0.13-1ubuntu18.04_amd64.deb ...
Unpacking mysql-server (8.0.13-1ubuntu18.04) ...
Setting up mysql-community-server (8.0.13-1ubuntu18.04) ...
mysqld: Can't create directory '/var/lib/mysql/' (OS errno 17 - File exists)
dpkg: error processing package mysql-community-server (--configure):
 installed mysql-community-server package post-installation script subprocess returned error exit status 1
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          dpkg: dependency problems prevent configuration of mysql-server:
 mysql-server depends on mysql-community-server (= 8.0.13-1ubuntu18.04); however:
  Package mysql-community-server is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 mysql-community-server
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

I can't seem to find a solution.

EDIT: Output from ls -lah /var/lib/mysql

total 8.0K
drwxr-x---  2 mysql mysql 4.0K Nov 11 16:01 .
drwxr-xr-x 70 root  root  4.0K Nov 11 16:01 ..

EDIT: After purging mysql-community-server I now get this output:

sudo apt-get install mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libmecab2 mecab-ipadic mecab-ipadic-utf8 mecab-utils
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  mysql-client-5.7 mysql-client-core-5.7 mysql-common mysql-server-5.7 mysql-server-core-5.7
Suggested packages:
  mailx tinyca
The following NEW packages will be installed:
  mysql-client-5.7 mysql-client-core-5.7 mysql-common mysql-server mysql-server-5.7 mysql-server-core-5.7
0 upgraded, 6 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/20.3 MB of archives.
After this operation, 160 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Preconfiguring packages ...
Selecting previously unselected package mysql-common.
(Reading database ... 283582 files and directories currently installed.)
Preparing to unpack .../mysql-common_5.8+1.0.4_all.deb ...
Unpacking mysql-common (5.8+1.0.4) ...
Selecting previously unselected package mysql-client-core-5.7.
Preparing to unpack .../mysql-client-core-5.7_5.7.24-0ubuntu0.18.04.1_amd64.deb ...
Unpacking mysql-client-core-5.7 (5.7.24-0ubuntu0.18.04.1) ...
Selecting previously unselected package mysql-client-5.7.
Preparing to unpack .../mysql-client-5.7_5.7.24-0ubuntu0.18.04.1_amd64.deb ...
Unpacking mysql-client-5.7 (5.7.24-0ubuntu0.18.04.1) ...
Selecting previously unselected package mysql-server-core-5.7.
Preparing to unpack .../mysql-server-core-5.7_5.7.24-0ubuntu0.18.04.1_amd64.deb ...
Unpacking mysql-server-core-5.7 (5.7.24-0ubuntu0.18.04.1) ...
Setting up mysql-common (5.8+1.0.4) ...
update-alternatives: using /etc/mysql/my.cnf.fallback to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Selecting previously unselected package mysql-server-5.7.
(Reading database ... 283738 files and directories currently installed.)
Preparing to unpack .../mysql-server-5.7_5.7.24-0ubuntu0.18.04.1_amd64.deb ...
Unpacking mysql-server-5.7 (5.7.24-0ubuntu0.18.04.1) ...
Selecting previously unselected package mysql-server.
Preparing to unpack .../mysql-server_5.7.24-0ubuntu0.18.04.1_all.deb ...
Unpacking mysql-server (5.7.24-0ubuntu0.18.04.1) ...
Processing triggers for ureadahead (0.100.0-20) ...
Setting up mysql-server-core-5.7 (5.7.24-0ubuntu0.18.04.1) ...
Processing triggers for systemd (237-3ubuntu10.4) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Setting up mysql-client-core-5.7 (5.7.24-0ubuntu0.18.04.1) ...
Setting up mysql-client-5.7 (5.7.24-0ubuntu0.18.04.1) ...
Setting up mysql-server-5.7 (5.7.24-0ubuntu0.18.04.1) ...
update-alternatives: using /etc/mysql/mysql.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Renaming removed key_buffer and myisam-recover options (if present)
Specified filename /var/lib/mysql/ibdata1 does not exist.
2018-11-11T06:05:28.592183Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-11-11T06:05:28.592279Z 0 [Warning] Can't create test file /storage/mnt/var/lib/mysql/nibiru.lower-test
2018-11-11T06:05:28.592315Z 0 [Note] mysqld (mysqld 5.7.24-0ubuntu0.18.04.1) starting as process 24387 ...
2018-11-11T06:05:28.593679Z 0 [Warning] Can't create test file /var/lib/mysql/nibiru.lower-test
2018-11-11T06:05:28.593692Z 0 [Warning] Can't create test file /var/lib/mysql/nibiru.lower-test
2018-11-11T06:05:28.594276Z 0 [ERROR] Could not open file '/var/log/mysql/error.log' for error logging: Permission denied
2018-11-11T06:05:28.594290Z 0 [ERROR] Aborting

2018-11-11T06:05:28.594302Z 0 [Note] Binlog end
2018-11-11T06:05:28.594330Z 0 [Note] mysqld: Shutdown complete

Initialization of mysqld failed: 0
Warning: Unable to start the server.
Created symlink /etc/systemd/system/multi-user.target.wants/mysql.service → /lib/systemd/system/mysql.service.
Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.
invoke-rc.d: initscript mysql, action "start" failed.
● mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: exit-code) since Sun 2018-11-11 19:05:29 NZDT; 3ms ago
  Process: 24568 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=1/FAILURE)
 Main PID: 30973 (code=exited, status=1/FAILURE)
dpkg: error processing package mysql-server-5.7 (--configure):
 installed mysql-server-5.7 package post-installation script subprocess 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
Processing triggers for systemd (237-3ubuntu10.4) ...
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          Processing triggers for ureadahead (0.100.0-20) ...
Errors were encountered while processing:
 mysql-server-5.7
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
9
  • can you add the output from ls -lah /var/lib/mysql ?
    – bistoco
    Nov 11, 2018 at 3:30
  • I have added the output
    – Rob
    Nov 11, 2018 at 4:33
  • I don't see anything weird, what about sudo ls -lah /var/lib/ | grep mysql (i'm comparing to my own installation)
    – bistoco
    Nov 11, 2018 at 5:08
  • Try remove mysql-community-server: sudo apt-get purge mysql-community-server
    – mja
    Nov 11, 2018 at 5:32
  • I have tried to purge all mysql* and re-install, same result
    – Rob
    Nov 11, 2018 at 5:36

0

Browse other questions tagged .