0

This question already has an answer here:

I was following a video about how to install the MySQL database in the Debian 8 from youtube, https://www.youtube.com/watch?v=Qg_wb_eZOrk

It was the point when I tried to install MySQL server using the command from the root,

apt-get install -y mysql-server-5.5

I get the follwoing erros,

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  fonts-lato libnuma1 libperconaserverclient18.1 libqt4-network libqt4-opengl
  libqt4-xmlpatterns libqt5clucene5 libqt5core5a libqt5dbus5 libqt5designer5
  libqt5gui5 libqt5help5 libqt5network5 libqt5opengl5 libqt5printsupport5
  libqt5qml5 libqt5quick5 libqt5sql5 libqt5sql5-sqlite libqt5svg5 libqt5test5
  libqt5webkit5 libqt5widgets5 libqt5xml5 libqtwebkit-qupzillaplugins
  libqtwebkit4 libxcb-render-util0 percona-server-common-5.6 python3-hunspell
  python3-notify2 python3-pyqt5 python3-pyqt5.qtsvg python3-pyqt5.qtwebkit
  python3-sip qttranslations5-l10n
Use 'apt-get autoremove' to remove them.
Suggested packages:
  tinyca
The following NEW packages will be installed:
  mysql-server-5.5
0 upgraded, 1 newly installed, 0 to remove and 5 not upgraded.
1 not fully installed or removed.
Need to get 0 B/1,768 kB of archives.
After this operation, 32.4 MB of additional disk space will be used.
Preconfiguring packages ...
(Reading database ... 162903 files and directories currently installed.)
Preparing to unpack .../mysql-server-5.5_5.5.58-0+deb8u1_amd64.deb ...
Aborting downgrade from (at least) 5.6 to 5.5.
If are sure you want to downgrade to 5.5, remove the file
/var/lib/mysql/debian-*.flag and try installing again.
dpkg: error processing archive /var/cache/apt/archives/mysql-server-5.5_5.5.58-0+deb8u1_amd64.deb (--unpack):
 subprocess new pre-installation script returned error exit status 1
Errors were encountered while processing:
 /var/cache/apt/archives/mysql-server-5.5_5.5.58-0+deb8u1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

How is wrong here and how to fix it?

Update

When I run the command of dpkg --get-selections | grep "mysql"

I get the outputs like,

libdbd-mysql-perl               install
libmysqlclient18:amd64              install
mysql-client-5.5                install
mysql-common                    install
mysql-server                    install
mysql-server-core-5.5               install
php5-mysql                  install

At the time I tried to login the MySQL with the command,

mysql -u root -p
Enter password: 

I get the following output,

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

UPADTE1:

I removed the mentioned file and tried to install again.

root@debian8:~# rm /var/lib/mysql/debian-*.flag

However, I ended up with some new errors,

root@debian8:~# sudo apt-get install -y mysql-server-5.5
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  fonts-lato libnuma1 libperconaserverclient18.1 libqt4-network libqt4-opengl
  libqt4-xmlpatterns libqt5clucene5 libqt5core5a libqt5dbus5 libqt5designer5
  libqt5gui5 libqt5help5 libqt5network5 libqt5opengl5 libqt5printsupport5
  libqt5qml5 libqt5quick5 libqt5sql5 libqt5sql5-sqlite libqt5svg5 libqt5test5
  libqt5webkit5 libqt5widgets5 libqt5xml5 libqtwebkit-qupzillaplugins
  libqtwebkit4 libxcb-render-util0 percona-server-common-5.6 python3-hunspell
  python3-notify2 python3-pyqt5 python3-pyqt5.qtsvg python3-pyqt5.qtwebkit
  python3-sip qttranslations5-l10n
Use 'apt-get autoremove' to remove them.
Suggested packages:
  tinyca
The following NEW packages will be installed:
  mysql-server-5.5
0 upgraded, 1 newly installed, 0 to remove and 5 not upgraded.
1 not fully installed or removed.
Need to get 0 B/1,768 kB of archives.
After this operation, 32.4 MB of additional disk space will be used.
Preconfiguring packages ...
(Reading database ... 162903 files and directories currently installed.)
Preparing to unpack .../mysql-server-5.5_5.5.58-0+deb8u1_amd64.deb ...
Unpacking mysql-server-5.5 (5.5.58-0+deb8u1) ...
Processing triggers for systemd (215-17+deb8u7) ...
Processing triggers for man-db (2.7.0.2-5) ...
Setting up mysql-server-5.5 (5.5.58-0+deb8u1) ...
Installing new version of config file /etc/init.d/mysql ...
Installing new version of config file /etc/mysql/debian-start ...
171217 17:41:34 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
171217 17:41:34 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
171217 17:41:34 [Note] /usr/sbin/mysqld (mysqld 5.5.58-0+deb8u1) starting as process 11587 ...
Job for mysql.service failed. See 'systemctl status mysql.service' and 'journalctl -xn' for details.
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing package mysql-server-5.5 (--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.5; however:
  Package mysql-server-5.5 is not configured yet.

dpkg: error processing package mysql-server (--configure):
 dependency problems - leaving unconfigured
Processing triggers for systemd (215-17+deb8u7) ...
Errors were encountered while processing:
 mysql-server-5.5
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

Update2

I type the command, sudo systemctl status mysql.service

The output in the terminal is,

● mysql.service - LSB: Start and stop the mysql database server daemon
   Loaded: loaded (/etc/init.d/mysql)
   Active: failed (Result: exit-code) since Sun 2017-12-17 17:42:09 +06; 1h 41min ago

Dec 17 17:42:09 debian8 /etc/init.d/mysql[12564]: 0 processes alive and '/usr...
Dec 17 17:42:09 debian8 /etc/init.d/mysql[12564]: [61B blob data]
Dec 17 17:42:09 debian8 /etc/init.d/mysql[12564]: error: 'Can't connect to lo...
Dec 17 17:42:09 debian8 /etc/init.d/mysql[12564]: Check that mysqld is runnin...
Dec 17 17:42:09 debian8 /etc/init.d/mysql[12564]: 
Dec 17 17:42:09 debian8 mysql[11709]: Starting MySQL database server: mysql...d!
Dec 17 17:42:09 debian8 systemd[1]: mysql.service: control process exited, ...=1
Dec 17 17:42:09 debian8 systemd[1]: Failed to start LSB: Start and stop the...n.
Dec 17 17:42:09 debian8 systemd[1]: Unit mysql.service entered failed state.
Hint: Some lines were ellipsized, use -l to show in full.haklader@debian8:/home/cx-components$ sudo systemctl status mysql.service
● mysql.service - LSB: Start and stop the mysql database server daemon
   Loaded: loaded (/etc/init.d/mysql)
   Active: failed (Result: exit-code) since Sun 2017-12-17 17:42:09 +06; 1h 41min ago

Dec 17 17:42:09 debian8 /etc/init.d/mysql[12564]: 0 processes alive and '/usr...
Dec 17 17:42:09 debian8 /etc/init.d/mysql[12564]: [61B blob data]
Dec 17 17:42:09 debian8 /etc/init.d/mysql[12564]: error: 'Can't connect to lo...
Dec 17 17:42:09 debian8 /etc/init.d/mysql[12564]: Check that mysqld is runnin...
Dec 17 17:42:09 debian8 /etc/init.d/mysql[12564]: 
Dec 17 17:42:09 debian8 mysql[11709]: Starting MySQL database server: mysql...d!
Dec 17 17:42:09 debian8 systemd[1]: mysql.service: control process exited, ...=1
Dec 17 17:42:09 debian8 systemd[1]: Failed to start LSB: Start and stop the...n.
Dec 17 17:42:09 debian8 systemd[1]: Unit mysql.service entered failed state.
Hint: Some lines were ellipsized, use -l to show in full.

I type the command, sudo journalctl -xn

The output in the terminal is,

-- Logs begin at Sun 2017-12-17 10:33:35 +06, end at Sun 2017-12-17 19:24:38 +06
Dec 17 19:23:41 debian8 su[10689]: pam_unix(su:session): session closed for user
Dec 17 19:23:47 debian8 sudo[15078]: chaklader : TTY=pts/0 ; PWD=/home/cx-compon
Dec 17 19:23:47 debian8 sudo[15078]: pam_unix(sudo:session): session opened for 
Dec 17 19:23:47 debian8 sudo[15078]: pam_unix(sudo:session): session closed for 
Dec 17 19:24:31 debian8 gdm-Xorg-:0[876]: (II) PRLCONTROL: GL PBuffer(this=0x563
Dec 17 19:24:31 debian8 gdm-Xorg-:0[876]: (II) PRLCONTROL: GL PBuffer(this=0x563
Dec 17 19:24:32 debian8 gdm-Xorg-:0[876]: (II) PRLCONTROL: GL PBuffer(this=0x563
Dec 17 19:24:32 debian8 gdm-Xorg-:0[876]: (II) PRLCONTROL: GL PBuffer(this=0x563
Dec 17 19:24:38 debian8 sudo[15262]: chaklader : TTY=pts/0 ; PWD=/home/cx-compon
Dec 17 19:24:38 debian8 sudo[15262]: pam_unix(sudo:session): session opened for 
lines 1-11/11 (END)

marked as duplicate by JdeBP, user259412, Community Dec 18 '17 at 10:20

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • It seems there is a mysql server installed already in version 5.6 and you are trying to downgrade that. To check which mysql versions are installed you can use dpkg --get-selections | grep mysql. But it might be that an application you already installed depends on the newer mysql version. Maybe you are happy with the newer version... – Thomas Dec 17 '17 at 10:44
  • I updated the answer and I have already installed mysql-server-core-5.5 and mysql-server in the system. Why cant I still login the MySQL? – Arefe Dec 17 '17 at 10:47
  • Alright, did you already tried If are sure you want to downgrade to 5.5, remove the file /var/lib/mysql/debian-*.flag and try installing again. what is suggested by the apt-get command? – Thomas Dec 17 '17 at 10:55
  • I have tried, but, this doesn't work as intended. Have a look at the updated answer where I get the error mysql-server depends on mysql-server-5.5; however: Package mysql-server-5.5 is not configured yet. – Arefe Dec 17 '17 at 11:46
  • 1
    Please post output of systemctl status mysql.service and journalctl -xn as your last error indicates, it cannot start the mysql unit. – thecarpy Dec 17 '17 at 12:38

Browse other questions tagged or ask your own question.