Bug #83088 cannot start mysqld with --skip-grant-tables option
Submitted: 21 Sep 2016 22:16 Modified: 21 Sep 2016 22:49
Reporter: Scott Classen Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.7.15 OS:CentOS (7.2.1511)
Assigned to: CPU Architecture:Any

[21 Sep 2016 22:16] Scott Classen
Description:
When attempting to start mysqld with the --skip-grant-tables option I receive an error. I expect the mysqld service to start normaly.

[root@www ~]# systemctl stop mysqld
[root@www ~]# systemctl set-environment MYSQLD_OPTS="--skip-grant-tables"
[root@www ~]# systemctl start mysqld
Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.
[root@www ~]# systemctl status mysqld.service
● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/mysqld.service.d
           └─override.conf
   Active: activating (start-pre) since Wed 2016-09-21 15:14:35 PDT; 404ms ago
  Process: 10785 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=1/FAILURE)
 Main PID: 29807 (code=exited, status=0/SUCCESS);         : 10834 (mysqld_pre_syst)
   CGroup: /system.slice/mysqld.service
           └─control
             ├─10834 /bin/bash /usr/bin/mysqld_pre_systemd
             └─10851 /usr/bin/python -Es /usr/sbin/semanage fcontext -a -e /var/lib/mysql /var/lib/mysql-files

Sep 21 15:14:35 my.system.com systemd[1]: Starting MySQL Server...
[root@www ~]# systemctl unset-environment MYSQLD_OPTS
[root@www ~]# systemctl start mysqld
[root@www ~]# systemctl status mysqld.service
● mysqld.service - MySQL Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/mysqld.service.d
           └─override.conf
   Active: active (running) since Wed 2016-09-21 15:14:51 PDT; 3s ago
  Process: 11087 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)
  Process: 11051 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
 Main PID: 11091 (mysqld)
   CGroup: /system.slice/mysqld.service
           └─11091 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid

Sep 21 15:14:49 my.system.com systemd[1]: Starting MySQL Server...
Sep 21 15:14:51 my.system.com systemd[1]: Started MySQL Server.
Sep 21 15:14:53 my.system.com systemd[1]: Started MySQL Server.

How to repeat:
1. Stop mysql:
systemctl stop mysqld

2. Set the mySQL environment option 
systemctl set-environment MYSQLD_OPTS="--skip-grant-tables"

3. Start mysql usig the options you just set
systemctl start mysqld

Suggested fix:
not sure... but I've forgotten my root password and need to reset it ASAP.
[21 Sep 2016 22:40] Miguel Solorzano
Thank you for the bug report.

[root@tikal miguel]# lsb_release -d
Description:    CentOS Linux release 7.2.1511 (Core)
[root@tikal miguel]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.15 MySQL Community Server (GPL)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> exit
Bye
[root@tikal miguel]# systemctl stop mysqld
[root@tikal miguel]# mysql -uroot -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
[root@tikal miguel]# systemctl set-environment MYSQLD_OPTS="--skip-grant-tables"
[root@tikal miguel]# systemctl start mysqld
[root@tikal miguel]# mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.15 MySQL Community Server (GPL)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>
[21 Sep 2016 22:49] Scott Classen
Well clearly it is working for you. On the surface it appears we are running the same mysql binary on the same OS, but something is not working for me. Any advice on how to further debug this issue would be greatly appreciated.