mysql service won't start

Hi guys, I read lots of threads and tried different solutions, but my mysql service won’t start. I was on MariaDB 10.1 which was installed by default with the system and it was working fine. I wanted to downgrade and switch to MySQL Community Server 5.7 for reasons, so I added the server:database repo and installed it while automatically removing MariaDB. But now the service won’t start and there isn’t any log which helps me debugging it.

Running “sudo rcmysql start” just gives me the “check journalctl -xe” message, but when I do there are no errors.

systemctl status mysql.service

● mysql.service - MySQL server
   Loaded: loaded (/usr/lib/systemd/system/mysql.service; disabled; vendor preset: disabled)
   Active: activating (start-pre) since Fri 2017-08-25 15:58:29 CEST; 18s ago
  Process: 32414 ExecStartPre=/usr/lib/mysql/mysql-systemd-helper install default (code=exited, status=0/SUCCESS)
 Main PID: 2424 (code=exited, status=1/FAILURE); Control PID: 32421 (mysql-systemd-h)
    Tasks: 2 (limit: 4915)
   CGroup: /system.slice/mysql.service
           └─control
             └─32421 /bin/bash /usr/lib/mysql/mysql-systemd-helper upgrade default

So I tried to go back to MariaDB but the error persists.

Your post only says “activating” not “running”

And,
You should use systemd commands, not “rc” commands, eg

systemctl status mysql
systemctl start mysql

TSU

I used the command you suggested but the outcome is exactly the same. Using Yast Services Manager, I can Enable the mysql service, but if I try to activate it and apply, it crashes. Also, going into the Show details button it tells this:

 * mysql.service - MySQL server   Loaded: loaded (/usr/lib/systemd/system/mysql.service; enabled; vendor preset: disabled)
   Active: activating (start-pre) since Fri 2017-08-25 16:18:44 CEST; 24s ago
  Process: 28736 ExecStartPre=/usr/lib/mysql/mysql-systemd-helper install default (code=exited, status=0/SUCCESS)
 Main PID: 2424 (code=exited, status=1/FAILURE); Control PID: 28744 (mysql-systemd-h)
    Tasks: 2 (limit: 4915)
   CGroup: /system.slice/mysql.service
           `-control
             |-28744 /bin/bash /usr/lib/mysql/mysql-systemd-helper upgrade default
             `-31735 sleep 1


Aug 25 16:18:44 linux-0122 mysql-systemd-helper[28744]: Checking MySQL configuration for obsolete options...
Aug 25 16:18:44 linux-0122 mysql-systemd-helper[28744]: Trying to run upgrade of MySQL databases...
Aug 25 16:18:44 linux-0122 mysql-systemd-helper[28744]: Stale files from previous upgrade detected, cleaned them up
Aug 25 16:18:44 linux-0122 mysql-systemd-helper[28744]: Running protected MySQL...
Aug 25 16:18:44 linux-0122 mysql-systemd-helper[28744]: Waiting for MySQL to start
Aug 25 16:18:45 linux-0122 mysql-systemd-helper[28744]: 2017-08-25T14:18:45.078905Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
Aug 25 16:18:45 linux-0122 mysql-systemd-helper[28744]: 2017-08-25T14:18:45.078948Z 0 [Warning] 'NO_AUTO_CREATE_USER' sql mode is not set. It will be made read-only in a future release.
Aug 25 16:18:45 linux-0122 mysql-systemd-helper[28744]: 2017-08-25T14:18:45.078987Z 0 [Warning] Failed to normalize the argument for --secure-file-priv.
Aug 25 16:18:45 linux-0122 mysql-systemd-helper[28744]: 2017-08-25T14:18:45.078995Z 0 [ERROR] Aborting
Aug 25 16:18:45 linux-0122 mysql-systemd-helper[28744]: 2017-08-25T14:18:45.079012Z 0 [Note] Binlog end

You can’t go from MariaDB 10.1 to MySQL CE 5.7 any more simply by installing it, the database formats aren’t fully compatible in all cases and can cause all sorts of interesting issues.

The proper way is to mysqldump all your database content to a file, shut down the MySQL or MariaDB service, clear (or preferably move) out the database directories content to a safe location, install the new service and then import the .sql file with mysql command line application.

MariaDB handles MySQL -> MariaDB transition but not vice versa.

Thanks for your reply, I’ve tried that. After removing the software I’ve cleared /var/lib/mysql and deleted /etc/my.cnf and although the service still won’t start, I get a different systemctl error. This is what I’ve tried after clearing the datadir:

 fwatches@linux-0122 /  $ sudo systemctl start mysql
Job for mysql.service failed because the control process exited with error code.
See "systemctl  status mysql.service" and "journalctl  -xe" for details.
 ▲  fwatches@linux-0122 /  $ systemctl status mysql
**●** mysql.service - MySQL server
   Loaded: loaded (/usr/lib/systemd/system/mysql.service; disabled; vendor preset: disabled)
   Active: **failed** (Result: exit-code) since Mon 2017-08-28 09:35:52 CEST; 6s ago
  Process: 23715 ExecStartPre=/usr/lib/mysql/mysql-systemd-helper install default **(code=exited, status=1/FAILURE)**
 Main PID: 2424 (code=exited, status=1/FAILURE)
 ▲  fwatches@linux-0122 /  $ sudo systemctl enable mysql
Created symlink /etc/systemd/system/multi-user.target.wants/mysql.service → /usr/lib/systemd/system/mysql.service.
 fwatches@linux-0122 /  $ sudo systemctl start mysql
Job for mysql.service failed because the control process exited with error code.
See "systemctl  status mysql.service" and "journalctl  -xe" for details.
 ▲  fwatches@linux-0122 /  $ systemctl status mysql
**●** mysql.service - MySQL server
   Loaded: loaded (/usr/lib/systemd/system/mysql.service; enabled; vendor preset: disabled)
   Active: **failed** (Result: exit-code) since Mon 2017-08-28 09:36:31 CEST; 3s ago
  Process: 23857 ExecStartPre=/usr/lib/mysql/mysql-systemd-helper install default **(code=exited, status=1/FAILURE)**
 Main PID: 2424 (code=exited, status=1/FAILURE)


If your database files are completely removed,
You should force re-install your MysSQL to re-apply defaults.
eg

zypper in -f *packagename* 

Then,
enable your MySQL so that it starts automatically on boot

systemtl enable mysql.service

And, start your service

systemctl start mysql.service

You should then apply and configure your MySQL application security by running the MySQL security configuration script. Personally, I create a HereDoc that runs the script so that I can later know how this was configured. I describe this in the following article. If you need to set up multiple machines or multiple instances the same way, this can also help you standardize your setup.

https://en.opensuse.org/User:Tsu2/MySQL_and_Mariadb

After completing your setup, <then> you can import your data.

TSU