Home  >  Article  >  Database  >  What is the command to disconnect the mysql server?

What is the command to disconnect the mysql server?

下次还敢
下次还敢Original
2024-04-22 19:27:41737browse

To disconnect from the MySQL server, use the "mysql -u [username] -p [password] -h [hostname] -P [port number] -e "quit"" command. Among them: [username] is the MySQL user name, [password] is the user password, [hostname] is the host name or IP address of the MySQL server, [port number] is the port number of the MySQL server (default is 3306), "quit " is the disconnect command.

What is the command to disconnect the mysql server?

Command to disconnect the MySQL server

To disconnect the MySQL server, you can use the following command:

<code>mysql -u [用户名] -p [密码] -h [主机名] -P [端口号] -e "quit"</code>

Command explanation:

  • mysql: MySQL client command.
  • -u [username]: Specifies the MySQL username to use.
  • -p [Password]: Specify the user's password.
  • -h [hostname]: Specify the hostname or IP address of the MySQL server.
  • -P [port number]: Specify the port number of the MySQL server (default value is 3306).
  • -e "quit": Execute the "quit" command to disconnect from the server.

Example:

The following example demonstrates how to disconnect from the MySQL server named "mydb" with the user name "root" and the password " mypass":

<code>mysql -u root -p mypass -h mydb.example.com -e "quit"</code>

After executing this command, you will disconnect from the MySQL server.

The above is the detailed content of What is the command to disconnect the mysql server?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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