Bug #72658 [ERROR] Fatal error: Please read "Security" section while using mysqlserverinfo
Submitted: 15 May 2014 13:23 Modified: 12 Jun 2014 2:29
Reporter: Shahriyar Rzayev Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Utilities Severity:S1 (Critical)
Version:1.4.2 OS:Linux (CentOS 6.5)
Assigned to: CPU Architecture:Any

[15 May 2014 13:23] Shahriyar Rzayev
Description:
Dear all,
After testing mysqluserclone i have reported all problems what i found.
So going on to with mysqlserverinfo i want to use --start option as stated in documentation it must start MySQL as read-only:

http://dev.mysql.com/doc/mysql-utilities/1.4/en/mysqlserverinfo.html

So first of all i can start and stop MySQL without any problem as root user:

[root@linuxsrv3 ~]# service mysqld restart
Stopping mysqld:                                           [  OK  ]
Starting mysqld:                                           [  OK  ]

As stated i must provide --basedir and --datadir so finding this value as below:

mysql> select @@basedir;
+-----------+
| @@basedir |
+-----------+
| /usr      |
+-----------+
1 row in set (0,00 sec)

mysql> select @@datadir;
+-----------------+
| @@datadir       |
+-----------------+
| /var/lib/mysql/ |
+-----------------+
1 row in set (0,00 sec)

After all i stopped MySQL and used following syntax to start MySQL:

[root@linuxsrv3 ~]# service mysqld stop
Stopping mysqld:                                           [  OK  ]

[root@linuxsrv3 ~]# mysqlserverinfo --basedir=/usr --datadir=/var/lib/mysql --start --server=root:12345@localhost --format=vertical
# Server is offline.
# Checking server version ... done.
# Starting read-only instance of the server ... ERROR: Cannot connect to the read_only server.
Error Can't connect to MySQL server on 'localhost:3306' (111 Connection refused)

Again unclear error message. for further Using with -vvv option:

[root@linuxsrv3 ~]# mysqlserverinfo --basedir=/usr --datadir=/var/lib/mysql --start --server=root:12345@localhost --format=vertical -vvv
# Server is offline.
# Checking server version ... done.
2014-05-15 18:09:54 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2014-05-15 18:09:54 5208 [ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!

2014-05-15 18:09:54 5208 [ERROR] Aborting

2014-05-15 18:09:54 5208 [Note] Binlog end
2014-05-15 18:09:54 5208 [Note] /usr/sbin/mysqld: Shutdown complete

# Starting read-only instance of the server ... ERROR: Cannot connect to the read_only server.
Error Can't connect to MySQL server on 'localhost:3306' (111 Connection refused)

[root@linuxsrv3 ~]# service mysqld status
mysqld is stopped

It is now more complicated:

[ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root! --> actually i can run MySQL as root from terminal.

And again (111 Connection refused) here too.

How to repeat:
Stated at description.

Suggested fix:
Looking for fix :)
[15 May 2014 13:25] Shahriyar Rzayev
Even  with "mysql" user it is starts and then shuts down:

[root@linuxsrv3 ~]# su - mysql
-bash-4.1$ mysqlserverinfo --basedir=/usr --datadir=/var/lib/mysql --start --server=root:12345@localhost --format=vertical -vvv
# Server is offline.
# Checking server version ... done.
2014-05-15 18:23:23 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2014-05-15 18:23:23 6334 [Warning] Buffered warning: Changed limits: max_open_files: 1024 (requested 5000)

2014-05-15 18:23:23 6334 [Warning] Buffered warning: Changed limits: table_cache: 431 (requested 2000)

2014-05-15 18:23:23 6334 [Note] Plugin 'FEDERATED' is disabled.
2014-05-15 18:23:23 6334 [Note] Plugin 'InnoDB' is disabled.
2014-05-15 18:23:23 6334 [Note] Server hostname (bind-address): '*'; port: 3306
2014-05-15 18:23:23 6334 [Note] IPv6 is available.
2014-05-15 18:23:23 6334 [Note]   - '::' resolves to '::';
2014-05-15 18:23:23 6334 [Note] Server socket created on IP: '::'.
2014-05-15 18:23:24 6334 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.6.17'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Community Server (GPL)
# Starting read-only instance of the server ... done.
# Source on localhost: ... connected.
2014-05-15 18:23:24 6334 [Note] /usr/sbin/mysqld: Normal shutdown

2014-05-15 18:23:24 6334 [Note] Giving 0 client threads a chance to die gracefully
2014-05-15 18:23:24 6334 [Note] Shutting down slave threads
2014-05-15 18:23:24 6334 [Note] Forcefully disconnecting 0 remaining clients
2014-05-15 18:23:24 6334 [Note] Binlog end
2014-05-15 18:23:24 6334 [Note] Shutting down plugin 'partition'
2014-05-15 18:23:24 6334 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
2014-05-15 18:23:24 6334 [Note] Shutting down plugin 'BLACKHOLE'
2014-05-15 18:23:24 6334 [Note] Shutting down plugin 'ARCHIVE'
2014-05-15 18:23:24 6334 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
2014-05-15 18:23:24 6334 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
2014-05-15 18:23:24 6334 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
2014-05-15 18:23:24 6334 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
2014-05-15 18:23:24 6334 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
2014-05-15 18:23:24 6334 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
2014-05-15 18:23:24 6334 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
2014-05-15 18:23:24 6334 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
2014-05-15 18:23:24 6334 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
2014-05-15 18:23:24 6334 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
2014-05-15 18:23:24 6334 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
2014-05-15 18:23:24 6334 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
2014-05-15 18:23:24 6334 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
2014-05-15 18:23:24 6334 [Note] Shutting down plugin 'INNODB_FT_DELETED'
2014-05-15 18:23:24 6334 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2014-05-15 18:23:24 6334 [Note] Shutting down plugin 'INNODB_METRICS'
2014-05-15 18:23:24 6334 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2014-05-15 18:23:24 6334 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2014-05-15 18:23:24 6334 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
2014-05-15 18:23:24 6334 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2014-05-15 18:23:24 6334 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
2014-05-15 18:23:24 6334 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
2014-05-15 18:23:24 6334 [Note] Shutting down plugin 'INNODB_CMPMEM'
2014-05-15 18:23:24 6334 [Note] Shutting down plugin 'INNODB_CMP_RESET'
2014-05-15 18:23:24 6334 [Note] Shutting down plugin 'INNODB_CMP'
2014-05-15 18:23:24 6334 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
2014-05-15 18:23:24 6334 [Note] Shutting down plugin 'INNODB_LOCKS'
2014-05-15 18:23:24 6334 [Note] Shutting down plugin 'INNODB_TRX'
2014-05-15 18:23:24 6334 [Note] Shutting down plugin 'MyISAM'
2014-05-15 18:23:24 6334 [Note] Shutting down plugin 'MRG_MYISAM'
2014-05-15 18:23:24 6334 [Note] Shutting down plugin 'CSV'
2014-05-15 18:23:24 6334 [Note] Shutting down plugin 'MEMORY'
2014-05-15 18:23:24 6334 [Note] Shutting down plugin 'sha256_password'
2014-05-15 18:23:24 6334 [Note] Shutting down plugin 'mysql_old_password'
2014-05-15 18:23:24 6334 [Note] Shutting down plugin 'mysql_native_password'
2014-05-15 18:23:24 6334 [Note] Shutting down plugin 'binlog'
2014-05-15 18:23:24 6334 [Note] /usr/sbin/mysqld: Shutdown complete

# Shutting down server ... done.
*************************       1. row *************************
                   server: localhost:3306
              config_file: /etc/my.cnf
               binary_log: 
           binary_log_pos: 
                relay_log: 
            relay_log_pos: 
                  version: 5.6.17
                  datadir: /var/lib/mysql/
                  basedir: /usr
               plugin_dir: /usr/lib64/mysql/plugin/
              general_log: OFF
         general_log_file: 
    general_log_file_size: 
                log_error: 
      log_error_file_size: 
           slow_query_log: OFF
      slow_query_log_file: 
 slow_query_log_file_size: 
1 row.
#...done.

-bash-4.1$ mysql -u root -p
Enter password: 
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
-bash-4.1$ service mysqld status
mysqld is stopped
[16 May 2014 10:01] Shahriyar Rzayev
Information:
Using MySQL 5.6.17 from official Oracle yum Repo.
[19 May 2014 10:12] MySQL Verification Team
Hello Shahriyar,

Thank you for the bug report.
Verified as described.

Thanks,
Umesh
[12 Jun 2014 2:29] Philip Olson
Fixed as of the upcoming MySQL Utilities 1.4.4 release, and here's the changelog entry:

When running the "mysqlserverinfo" utility as root against an offline
MySQL server, it failed to start a read-only instance of the server and
emitted the fatal error "Please read "Security" section of the manual to
find out how to run mysqld as root!". This occurred because the mysqld
option "--user=root" was not passed in, which is mandatory when starting
mysqld as root. The "user_name" that executes the utility is now detected
and added as "--user="user_name"" when starting the read-only MySQL
server. 

Additionally, error checks were added that validate the "--basedir" and 
"--datadir" options to check for their existence and accessibility.

Thank you for the bug report.