Documentation Home
MySQL 9.4 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 41.2Mb
PDF (A4) - 41.3Mb
Man Pages (TGZ) - 262.8Kb
Man Pages (Zip) - 368.8Kb
Info (Gzip) - 4.1Mb
Info (Zip) - 4.1Mb


MySQL 9.4 Reference Manual  / ...  / MySQL Programs  / Installation-Related Programs  /  mysql_secure_installation — Improve MySQL Installation Security

6.4.2 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 forroot accounts.

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

  • You can remove anonymous-user accounts.

  • You can remove thetest 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 withtest_.

mysql_secure_installation helps you implement security recommendations similar to those described atSection 2.9.4, “Securing the Initial MySQL Account”.

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

mysql_secure_installation

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

Thevalidate_password component 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:

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, seeSection 6.2.2.2, “Using Option Files”.

Table 6.9 mysql_secure_installation Options

Option NameDescription
--defaults-extra-fileRead named option file in addition to usual option files
--defaults-fileRead only named option file
--defaults-group-suffixOption group suffix value
--helpDisplay help message and exit
--hostHost on which MySQL server is located
--no-defaultsRead no option files
--passwordAccepted but always ignored. Whenever mysql_secure_installation is invoked, the user is prompted for a password, regardless
--portTCP/IP port number for connection
--print-defaultsPrint default options
--protocolTransport protocol to use
--socketUnix socket file or Windows named pipe to use
--ssl-caFile that contains list of trusted SSL Certificate Authorities
--ssl-capathDirectory that contains trusted SSL Certificate Authority certificate files
--ssl-certFile that contains X.509 certificate
--ssl-cipherPermissible ciphers for connection encryption
--ssl-crlFile that contains certificate revocation lists
--ssl-crlpathDirectory that contains certificate revocation-list files
--ssl-fips-modeWhether to enable FIPS mode on client side
--ssl-keyFile that contains X.509 key
--ssl-modeDesired security state of connection to server
--ssl-session-dataFile that contains SSL session data
--ssl-session-data-continue-on-failed-reuseWhether to establish connections if session reuse fails
--tls-ciphersuitesPermissible TLSv1.3 ciphersuites for encrypted connections
--tls-sni-servernameServer name supplied by the client
--tls-versionPermissible TLS protocols for encrypted connections
--use-defaultExecute with no user interactivity
--userMySQL user name to use when connecting to server