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

JavaScript realizes the effect of mobile modal box

This article example shares the specific code of ...

How to optimize MySQL query speed

In the previous chapters, we introduced how to ch...

Detailed steps for Python script self-start and scheduled start under Linux

1. Python automatically runs at startup Suppose t...

Solution to the problem of invalid line-height setting in CSS

About the invalid line-height setting in CSS Let&...

Implementation of the login page of Vue actual combat record

Table of contents 1. Preliminary preparation 1.1 ...

How to use an image button as a reset form button

When we make a form, we often set a submit button ...

Example analysis of mysql stored procedure usage

This article describes the usage of MySQL stored ...

Appreciation of the low-key and elegant web design in black, white and gray

Among classic color combinations, probably no one...

Summary of web design experience and skills

■ Website theme planning Be careful not to make yo...

Docker deployment of Kafka and Spring Kafka implementation

This article mainly introduces the deployment of ...

How to deploy gitlab using Docker-compose

Docker-compose deploys gitlab 1. Install Docker I...

Ubuntu Server 16.04 MySQL 8.0 installation and configuration graphic tutorial

Ubuntu Server 16.04 MySQL 8.0 installation and co...

Steps for IDEA to integrate Docker to achieve remote deployment

1. Enable remote access to the docker server Log ...

MySQL database master-slave replication and read-write separation

Table of contents 1. Master-slave replication Mas...