Home > Database > Mysql Tutorial > body text

What are the commonly used commands in MySQL?

醉折花枝作酒筹
Release: 2021-07-12 16:30:30
forward
2552 people have browsed it

This article will introduce you to the common commands of MySQL in detail. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.

What are the commonly used commands in MySQL?

1. Start and stop the MySQL service

(Right-click to open the command prompt in administrator mode)

输入命令:net start mysql	来启动服务
Copy after login

What are the commonly used commands in MySQL?

输入命令:net stop mysql	来关闭服务
Copy after login

What are the commonly used commands in MySQL?

2. MySQL login and exit

2.0 MySQL parameters

What are the commonly used commands in MySQL?

##2.1 MySQL login

输入命令参数:mysql -u root -p
Copy after login

What are the commonly used commands in MySQL?

2.2 MySQL exit

Input parameters:

What are the commonly used commands in MySQL?

What are the commonly used commands in MySQL?

3. Modify the MySQL prompt

What are the commonly used commands in MySQL?

Method 1: Specify via parameters when connecting to the client

After we log in to MySQL, the original prompt should be [ >mysql], we change it to [localhost] through the following command

命令行:mysql -uroot -proot --prompt -\h
Copy after login

What are the commonly used commands in MySQL?

Method 2: After connecting to the client, modify it through the prompt command

prompt mysql>
Copy after login

At this time, the prompt will change to [mysql>]

What are the commonly used commands in MySQL?

4. Common commands

1. Display the version of the current server

SELECT VERSION();
Copy after login

What are the commonly used commands in MySQL?

2. Display the current date and time

SELECT NOW();
Copy after login

What are the commonly used commands in MySQL?

3. Display the current user

SELECT USER();
Copy after login

What are the commonly used commands in MySQL?

5. MySQL statement specifications

  • [Keyword] and [Function] names are all in uppercase letters

  • [Database] name , [Table] name, [Field] name all lowercase

  • [SQL] statement must end with [;]

Related recommendations: "

mysql tutorial

The above is the detailed content of What are the commonly used commands in MySQL?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:csdn.net
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
Popular Tutorials
More>
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!