I am trying to automatically install MySQL using the following commands:

echo 'mysql-server-5.5 mysql-server/root_password password some_password' | /usr/bin/debconf-set-selections
echo 'mysql-server-5.5 mysql-server/root_password_again password some_password' | /usr/bin/debconf-set-selections
export DEBIAN_FRONTEND=noninteractive
/usr/bin/apt-get install mysql-server-5.5 -y

However, during installation, I get this error:

Setting up mysql-server-5.5 (5.5.53-0+deb8u1) ...
161206 14:10:54 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
161206 14:10:54 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.
161206 14:10:54 [Note] /usr/sbin/mysqld (mysqld 5.5.53-0+deb8u1) starting as process 12755 ...
Configuring mysql-server-5.5

Unable to set password for the MySQL "root" user

An error occurred while setting the password for the MySQL administrative 
user. This may have happened because the account already has a password, or 
because of a communication problem with the MySQL server.

You should check the account's password after the package installation.

Please read the /usr/share/doc/mysql-server-5.5/README.Debian file for more information.

Job for mysql.service failed. See 'systemctl status mysql.service' and 'journalctl -xn' for details.
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing package mysql-server-5.5 (--configure):
 subprocess installed post-installation script returned error exit status 1

This is on a fresh server, so I'm not quite sure why this is occuring, as this post would show a past failed installation would be at fault.

If I login with --skip-grant-tables, and FLUSH PRIVILEGES, create a new user, restart mysql, the user works for login. Then the strangest thing (I think) occurs. Logging in with the new user, using the mysql database, and selecting all users, pulls up one row with no root user and one user (that I just created).

This script must be autodeployed, so I can't just manually do user creation on every server.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.