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

Use of Vue3 table component

Table of contents 1. Ant Design Vue 1. Official w...

Use of Linux gzip command

1. Command Introduction The gzip (GNU zip) comman...

JavaScript implements the detailed process of stack structure

Table of contents 1. Understanding the stack stru...

Detailed explanation of galera-cluster deployment in cluster mode of MySQL

Table of contents 1: Introduction to galera-clust...

HTML user registration page settings source code

Design the web page shown above: <!DOCTYPE htm...

How to use an image button as a reset form button

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

Detailed tutorial on running Tomcat in debug mode in IDEA Maven project

1. Add the following dependencies in pom.xml <...

Regular expression usage in CSS selectors

Yes, CSS has regular expressions too (Amen) Two p...

In-depth explanation of MySQL isolation level and locking mechanism

Table of contents Brief description: 1. Four char...

MySQL 8.0 New Features - Introduction to Check Constraints

Table of contents Preface Check Constraints Creat...

Solution to ONLY_FULL_GROUP_BY error in Mysql5.7 and above

Recently, during the development process, the MyS...

Detailed analysis of the blocking problem of js and css

Table of contents DOMContentLoaded and load What ...