Bug #72670 ERROR: Unable to communicate with new instance with mysqlserverclone
Submitted: 16 May 2014 13:27 Modified: 12 Jun 2014 2:18
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

[16 May 2014 13:27] Shahriyar Rzayev
Description:
Dear friends,

Want to test mysqlserverclone and found following problem:
Describing step-by-step:

[root@linuxsrv3 ~]# mkdir /var/lib/mysql2

[root@linuxsrv3 ~]# chown mysql:mysql /var/lib/mysql2

[root@linuxsrv3 ~]# ls -ld /var/lib/mysql2
drwxr-xr-x.  2 mysql   mysql   4096 2014-05-16 17:43 mysql2

First Usage of mysqlserverclone:
#1#
[root@linuxsrv3 ~]# mysqlserverclone --server=root:12345@localhost --new-data=/var/lib/mysql2 --new-port=3310 --root-password=12345 --mysqld=--log-bin=mysql-bin
# Cloning the MySQL server running on localhost.
# Configuring new instance...
# Locating mysql tools...
# Setting up empty database and mysql tables...
# Starting new instance of the server...
# Testing connection to new instance...
ERROR: Unable to communicate with new instance. Process id = 2913.

And checking directory:

[root@linuxsrv3 ~]# ls -l /var/lib/mysql2
total 110600
-rw-rw----. 1 root root 12582912 2014-05-16 17:48 ibdata1
-rw-rw----. 1 root root 50331648 2014-05-16 17:48 ib_logfile0
-rw-rw----. 1 root root 50331648 2014-05-16 17:48 ib_logfile1
drwx------. 2 root root     4096 2014-05-16 17:48 mysql
drwx------. 2 root root     4096 2014-05-16 17:48 performance_schema

As you noticed the directory owner has been changed to root.

Again chowned to mysql:mysql and now used with verbose mode:

[root@linuxsrv3 ~]# mysqlserverclone --server=root:12345@localhost --new-data=/var/lib/mysql2 --new-port=3310 --root-password=12345 --mysqld=--log-bin=mysql-bin -vvv --delete-data

# Cloning the MySQL server running on localhost.
# Creating new data directory...
# Configuring new instance...
# Locating mysql tools...
# Location of files:
#                       mysqld: /usr/sbin/mysqld
#                   mysqladmin: /usr/bin/mysqladmin
#      mysql_system_tables.sql: /usr/share/mysql/mysql_system_tables.sql
# mysql_system_tables_data.sql: /usr/share/mysql/mysql_system_tables_data.sql
# mysql_test_data_timezone.sql: /usr/share/mysql/mysql_test_data_timezone.sql
#         fill_help_tables.sql: /usr/share/mysql/fill_help_tables.sql

.
.
# Starting new instance of the server...
# Startup command for new server:
/usr/sbin/mysqld --no-defaults --datadir=/var/lib/mysql2 --tmpdir=/var/lib/mysql2 --pid-file=/var/lib/mysql2/clone.pid --port=3310 --server-id=2 --basedir=/usr --socket=/var/lib/mysql2/mysql.sock --log-bin=mysql-bin
# Testing connection to new instance...
# trying again...
2014-05-16 17:50:58 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2014-05-16 17:50:58 3022 [ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!

2014-05-16 17:50:58 3022 [ERROR] Aborting

2014-05-16 17:50:58 3022 [Note] Binlog end
# trying again...
2014-05-16 17:50:58 3022 [Note] /usr/sbin/mysqld: Shutdown complete

# trying again...
# trying again...
# trying again...
# trying again...
# trying again...
# trying again...
# trying again...
# trying again...
ERROR: Unable to communicate with new instance. Process id = 3022.

Again checked mysql2 directory permission and owner:
[root@linuxsrv3 lib]# ls -l | grep mysql
drwxr-xr-x. 11 mysql   mysql   4096 2014-05-16 17:49 mysql
drwxr-xr-x.  4 root    root    4096 2014-05-16 17:51 mysql2

mysql2 chowned again to root user.

But i have found solution it was possible to clone when run mysqlserverclone as  mysql user:

[root@linuxsrv3 lib]# chown -R mysql:mysql mysql2
[root@linuxsrv3 lib]# ls -l | grep mysql
drwxr-xr-x. 11 mysql   mysql   4096 2014-05-16 17:49 mysql
drwxr-xr-x.  4 mysql   mysql   4096 2014-05-16 17:51 mysql2

[root@linuxsrv3 lib]# su - mysql
-bash-4.1$ mysqlserverclone --server=root:12345@localhost --new-data=/var/lib/mysql2 --new-port=3310 --root-password=12345 --mysqld=--log-bin=mysql-bin -vvv --delete-data
.
.
# Starting new instance of the server...
# Startup command for new server:
/usr/sbin/mysqld --no-defaults --datadir=/var/lib/mysql2 --tmpdir=/var/lib/mysql2 --pid-file=/var/lib/mysql2/clone.pid --port=3310 --server-id=2 --basedir=/usr --socket=/var/lib/mysql2/mysql.sock --log-bin=mysql-bin
.
.
# trying again...
# Success!
# Setting the root password...
# Connection Information:
#  -uroot -p12345 --socket=/var/lib/mysql2/mysql.sock
#...done.

[root@linuxsrv3 lib]# mysql -uroot -p12345 --socket=/var/lib/mysql2/mysql.sock
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.6.17-log MySQL Community Server (GPL)

And now it is working.

How to repeat:
All necessary steps are provided in description

Suggested fix:
Let people to know that mysqlserverclone must be run as mysql user not as root user.
[22 May 2014 9:40] MySQL Verification Team
Hello Shahriyar,

Thank you for the bug report.
Verified as described.

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

Failed MySQL server connection error messages now return the actual error
returned from the failed connection, instead of a custom (and more
generic) error. This new behavior is more standard with how other MySQL
client applications behave.

Thank you for the bug report.