1

I have issues installing mysql,

sudo apt-get update
sudo apt-get install mysql-server

I also tried:

sudo dpkg -P mysql-server-5.1 mysql-server
sudo apt-get install mysql-server

I get the following error:

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 Mon 2017-05-15 14:43:06 CEST; 5ms ago
  Process: 22585 ExecStartPost=/usr/share/mysql/mysql-systemd-start post (code=exited, status=0/SUCCESS)
  Process: 22584 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
  Process: 22576 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
 Main PID: 22584 (code=exited, status=1/FAILURE)
      CPU: 485ms

maj 15 14:43:06 XPS-13-9350 systemd[1]: mysql.service: Unit entered failed state.
maj 15 14:43:06 XPS-13-9350 systemd[1]: mysql.service: Failed with result 'exit-code'.
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.
                                                                                                          Processing triggers for systemd (232-21ubuntu3) ...
Processing triggers for ureadahead (0.100.0-19) ...
Errors were encountered while processing:
 mysql-server-5.7
 mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

If I type mysql I get:

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

It seems to have semi-installed as if I do mysql -u root -p I get the password prompt, but nothing happens.

I tried starting it using sudo service mysql start but I got this error message in mysql.service:

$ systemctl status mysql.service

● mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
   Active: activating (start-post) (Result: exit-code) since Mon 2017-05-15 14:24:24 CEST; 13s ago
  Process: 13333 ExecStart=/usr/sbin/mysqld (code=exited, status=1/FAILURE)
  Process: 13317 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
 Main PID: 13333 (code=exited, status=1/FAILURE); Control PID: 13334 (mysql-systemd-s)
    Tasks: 2 (limit: 4915)
   Memory: 1.8M
      CPU: 353ms
   CGroup: /system.slice/mysql.service
           └─control
             ├─13334 /bin/bash /usr/share/mysql/mysql-systemd-start post
             └─13397 sleep 1

maj 15 14:24:24 XPS-13-9350 systemd[1]: Starting MySQL Community Server...
maj 15 14:24:26 XPS-13-9350 systemd[1]: mysql.service: Main process exited, code=exited, status=1/FAILURE
Gemtastic
  • 121

1 Answers1

1

One of the things that can cause this issue is when you already have a MySQL instance running. In my case I had a Docker image of a MySQL running while I was installing this new one.

If you have Docker installed check what images you are running with a simple ps:

$ docker ps

If you're insecure about if the instance is running MySQL on the standard port you can enter the image and log into the MySQL client and check which port it's running on with this:

$ docker exec -it image_name bash
root@<container_id>/# mysql -u username -p
Enter password:
mysql > SHOW GLOBAL VARIABLES LIKE 'PORT';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| port          | 3306  |
+---------------+-------+

Or you can just stop the image:

$ docker stop image_name

There are other ways to run multiple MySQL instances at once, if you do not have docker I believe you can do a ps -a | grep mysql to see all or atleast the most obvious mysql processes.

Gemtastic
  • 121