Command options for connecting to MySQL server

王林
Release: 2023-09-03 11:41:09
forward
800 people have browsed it

用于连接到 MySQL 服务器的命令选项

Let's take a look at the options supported by the MySQL client program. These options control how the client program establishes a connection with the server, whether the connection is encrypted or compressed.

These options can also be given on the command line or in an options file. The below mentioned command options can be used to establish the connection -

  • --default-auth: This is the authentication plugin that needs to be used.

  • --host: The host where the MySQL server is located.

  • --password: The required password to use when connecting to the server.

  • --pipe: Used to connect to the server using named pipes. For use on Windows only.

  • --plugin-dir: The directory where the plug-in is installed.

  • - -port: TCP/IP port number to use for the connection.

  • --protocol: The transport protocol used.

  • --socket: Unix socket file or Windows named pipe to use.

  • --user: refers to the MySQL user name used. Used when connecting to the server.

  • --default-auth=plugin: It gives a hint as to which client authentication plugin must be used.

  • --host=host_name, -h host_name: The host where the MySQL server runs. The value can be a hostname, IPv4 address, or IPv6 address. The default value is localhost.

  • --password[=pass_val],-p[pass_val]: Password for the MySQL account used Connect to the server. Password value is optional.

  • --port=port_num, -P port_num: For TCP/IP connections, it determines the port number that needs to be used. The default port number is 3306.

  • --protocol={TCP|SOCKET|PIPE|MEMORY}: This option explicitly tells which transport to use A protocol must be used to connect to the server Let’s take an example -

By default, connections to localhost on Unix are made using Unix socket files. As shown below -

mysql --host=localhost
Copy after login

To force the use of TCP/IP transport instead of the default, the --protocol option can be specified. As shown below -

mysql --host=localhost --protocol=TCP
Copy after login

The above is the detailed content of Command options for connecting to MySQL server. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!