Documentation Home
MySQL 5.7 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 39.3Mb
PDF (A4) - 39.3Mb
PDF (RPM) - 38.6Mb
HTML Download (TGZ) - 11.1Mb
HTML Download (Zip) - 11.1Mb
HTML Download (RPM) - 9.8Mb
Man Pages (TGZ) - 212.5Kb
Man Pages (Zip) - 321.6Kb
Info (Gzip) - 3.6Mb
Info (Zip) - 3.6Mb
Excerpts from this Manual

MySQL 5.7 Reference Manual  /  ...  /  mysql_secure_installation — Improve MySQL Installation Security

4.4.4 mysql_secure_installation — Improve MySQL Installation Security

This program enables you to improve the security of your MySQL installation in the following ways:

  • You can set a password for root accounts.

  • You can remove root accounts that are accessible from outside the local host.

  • You can remove anonymous-user accounts.

  • You can remove the test database (which by default can be accessed by all users, even anonymous users), and privileges that permit anyone to access databases with names that start with test_.

mysql_secure_installation helps you implement security recommendations similar to those described at Section 2.10.4, “Securing the Initial MySQL Account”.

Normal usage is to connect to the local MySQL server; invoke mysql_secure_installation without arguments:

shell> mysql_secure_installation

When executed, mysql_secure_installation prompts you to determine which actions to perform.

The validate_password plugin can be used for password strength checking. If the plugin is not installed, mysql_secure_installation prompts the user whether to install it. Any passwords entered later are checked using the plugin if it is enabled.

Most of the usual MySQL client options such as --host and --port can be used on the command line and in option files. For example, to connect to the local server over IPv6 using port 3307, use this command:

shell> mysql_secure_installation --host=::1 --port=3307

mysql_secure_installation supports the following options, which can be specified on the command line or in the [mysql_secure_installation] and [client] groups of an option file. For information about option files used by MySQL programs, see Section 4.2.6, “Using Option Files”.

Table 4.7 mysql_secure_installation Options

Format Description Introduced
--defaults-extra-file Read named option file in addition to usual option files 5.7.2
--defaults-file Read only named option file 5.7.2
--defaults-group-suffix Option group suffix value 5.7.2
--help Display help message and exit 5.7.2
--host Host to connect to (IP address or host name) 5.7.2
--no-defaults Read no option files 5.7.2
--password Accepted but always ignored. Whenever mysql_secure_installation is invoked, the user is prompted for a password, regardless. 5.7.2
--port TCP/IP port number for connection 5.7.2
--print-defaults Print default options 5.7.2
--protocol Connection protocol to use 5.7.2
--socket For connections to localhost, the Unix socket file to use 5.7.2
--ssl Enable encrypted connection 5.7.2
--ssl-ca File that contains list of trusted SSL Certificate Authorities 5.7.2
--ssl-capath Directory that contains trusted SSL Certificate Authority certificate files 5.7.2
--ssl-cert File that contains X.509 certificate 5.7.2
--ssl-cipher List of permitted ciphers for connection encryption 5.7.2
--ssl-crl File that contains certificate revocation lists 5.7.2
--ssl-crlpath Directory that contains certificate revocation list files 5.7.2
--ssl-key File that contains X.509 key 5.7.2
--ssl-verify-server-cert Verify host name against server certificate Common Name identity 5.7.2
--tls-version Protocols permitted for encrypted connections 5.7.10
--use-default Execute with no user interactivity 5.7.4
--user MySQL user name to use when connecting to server 5.7.2


User Comments
User comments in this section are, as the name implies, provided by MySQL users. The MySQL documentation team is not responsible for, nor do they endorse, any of the information provided here.
  Posted by Kristian Köhntopp on October 3, 2012
mysql_secure_installation is not just unavailable on Windows, it is also not needed. The GUI installer von Windows offers to perform these post-installation steps, and enabled them even by default.
  Posted by Brian Pete on July 2, 2014
An alternative to the command mysql_secure_installation
http://howtolamp.com/lamp/mysql/5.6/securing/
  Posted by keith jolley on August 14, 2017
This program is probably not in your $PATH. On my install it was here: /usr/local/mysql-5.7.18-linux-glibc2.5-x86_64/bin/mysql_secure_installation
Sign Up Login You must be logged in to post a comment.