Description:
I am running into an issue where mysqladmin hangs when executed during server startup.
When executing "mysqladmin status" in a loop to determine when the database is ready after starting MySQL using "mysqld_safe", waiting for the process to exit with exit code 0, the mysqladmin command eventually hangs.
The command line is as follows:
mysqladmin --protocol=TCP --port=3306 --user=root --password= --no-beep status
Output from mysqladmin when run in a loop during server startup:
...
...
...
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to MySQL server on 'localhost' (61)'
Check that mysqld is running on localhost and that the port is 3306.
You can check this by doing 'telnet localhost 3306'
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to MySQL server on 'localhost' (61)'
Check that mysqld is running on localhost and that the port is 3306.
You can check this by doing 'telnet localhost 3306'
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to MySQL server on 'localhost' (61)'
Check that mysqld is running on localhost and that the port is 3306.
You can check this by doing 'telnet localhost 3306'
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
160318 17:13:26 mysqld_safe Logging to '<...>/logs/error.log'.
160318 17:13:26 mysqld_safe Starting mysqld daemon with databases from <...>/data
[Process hangs here]
How to repeat:
1) Unpack MySQL 5.7.10 binaries
2) Run mysqld --initialize-insecure
3) Run the bash script below:
#!/bin/bash
echo "Starting MySQL"
bin/mysqld_safe --defaults-file=db.cnf &
connect="--protocol=TCP --host=localhost --port=3306 --user=root --password="
# Wait for the database to start up
bin/mysqladmin $connect status
while [ $? -ne 0 ]
do
bin/mysqladmin $connect status
done
echo "MySQL started"