Special commands in MySql database query

Special commands in MySql database query

First: Installation of MySQL

Download the MySQL software and modify the installation path

Install the MySQL database 5.7.18

Step 1: Database MySQL5.7.18 can be downloaded from the official website, download address: http://www.filehorse.com/download-mysql-64/,

Step 2: Unzip the downloaded installation package to a disk.

Step 3: Configure environment variables, create a new environment variable MySQL_HOME, and enter the MySQL installation directory.

Then insert ;%MYSQL_HOME%\bin to the end of Path;

Step 4: Run the command line as an administrator, press win+R, enter cmd, right-click and run as an administrator.

Step 5: Switch to the MySQL installation directory and install it using mysqld:

Initialize data: mysqld --initialize-insecure --user=mysql,

Start the service: mysqld --user=mysql,

Initialize mysql root password mysqladmin -u root password 'new-password',

See https://dev.mysql.com/doc/refman/5.7/en/data-directory-initialization-mysqld.html for details.

Step 6: Register service mysqld --install MySQL

Start the service with the net start mysql command.

Enter the mysql -u root -p command: Then fill in the password entered when initializing the database in step 5, as shown below:

Enter show databases; in the mysql command to view the tables in the database, as shown in the following figure:

This indicates that the database has been installed successfully.

Second: Database special query statement

Sort in descending order, select name from data order by name desc; ---- here desc means sort in descending order

Query based on relative column position, select name, price from data order by 2,3; ----- 2,3 means sorting by the second column first, then by the third column.

Note: If you want to sort in descending order on multiple columns, you must specify each column with desc.

third:

The difference between creating a new link and creating a new database in Navicat database software

Creating a new link is to create a data link object, which contains the database

To create a data link,

Select the type of database link to create. Mine is MySQL, set the link name, password and port number.

Electronic MySQL create database

This will create the database.

Summarize

The above are the special commands in MySql database query that I introduced to you. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!

You may also be interested in:
  • 18 common commands in MySQL command line
  • Common operation commands of MySQL in Linux system
  • Centos7 restart apache, nginx, mysql, php-fpm command method
  • How to implement import and export mysql database commands under linux
  • Detailed explanation of the EXPLAIN command and its usage in MySQL
  • MySql common query command operation list
  • How to use commands in Mysql to achieve hierarchical search help detailed explanation
  • Solve the Chinese garbled problem of mysql5.5 database command line under Windows 10
  • Summary of Commonly Used MySQL Commands in Linux Operating System
  • Mysql uses the kill command to solve the deadlock problem (kill a certain SQL statement being executed)
  • MySQL 5.7 mysql command line client usage command details
  • MySQL database source command detailed explanation and examples
  • Common commands for mysql authorization, startup, and service startup

<<:  CentOS 7 switching boot kernel and switching boot mode explanation

>>:  Eight implementation solutions for cross-domain js front-end

Recommend

How to obtain root permissions in a docker container

First, your container must be running You can vie...

Solution to MySQL replication failure caused by disk fullness

Table of contents Case scenario Solving the probl...

HTML basic syntax is convenient for those who are just starting to learn HTML

1.1 General marking A general tag consists of an ...

You Probably Don’t Need to Use Switch Statements in JavaScript

Table of contents No switch, no complex code bloc...

Why MySQL database avoids NULL as much as possible

Many tables in MySQL contain columns that can be ...

Linux implements automatic and scheduled backup of MySQL database every day

Overview Backup is the basis of disaster recovery...

A simple and in-depth study of async and await in JavaScript

Table of contents 1. Introduction 2. Detailed exp...

Example code for implementing a pure CSS pop-up menu using transform

Preface When making a top menu, you will be requi...

JavaScript Basics Operators

Table of contents 1. Operators Summarize 1. Opera...

Reduce memory and CPU usage by optimizing web pages

Some web pages may not look large but may be very ...

How to use Webstorm and Chrome to debug Vue projects

Table of contents Preface 1. Create a new Vue pro...

JavaScript data transmission between different pages (URL parameter acquisition)

On web pages, we often encounter this situation: ...

About installing python3.8 image in docker

Docker Hub official website 1. Search for Python ...

MySql8 WITH RECURSIVE recursive query parent-child collection method

background When developing a feature similar to c...

In-depth analysis of MySQL execution plans

Preface In the previous interview process, when a...