Access the MySQL database by entering the DOS window through cmd under Windows

Access the MySQL database by entering the DOS window through cmd under Windows

1. Press win + R and type cmd to enter the DOS window.

2. Switch to the installation directory of MySQL server, that is, the directory where mysql.exe is located.

For example: cd C:\Program Files\MySQL\MySQL Server 5.5\bin

3. Execute the command to access the database:

For example: mysql -hlocalhost -P3306 -uroot -p

-h: server IP, localhost means local;

-P: port number, the default is 3306, optional.

-u: database connection user name

-p: Password. If a password is set, you can add it directly after -p. If no password is set, you do not need to set it.

4. Access the database and use it.

(1) Query the database instance: show databases;

(2) Select the database: use + database name, for example: use my. If the prompt "Database changed" appears, it means that the database has been switched to.

(3) Query all tables: show tables;

(4) Query table column names, table data and other data operations.

example:

show columns from user;

select uname,upass from user; 

More operations to be continued. . .

This is the end of this article about entering the DOS window to access the MySQL database through cmd under Windows. For more relevant content about accessing MySQL from the Windows cmd window, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Windows cmd command line input and output redirection problem
  • Windows CMD Commands (worth collecting)
  • How to copy Windows cmd window command line information
  • How to call cmd command and execute exe program in Java in Windows system
  • How to execute cmd commands in windows using java
  • How to start Windows applications, execute bat batch processing, and execute cmd commands with PHP (detailed explanation of exec and system functions)
  • Windows PowerShell cmdlets
  • How to hide cmd command prompt window when running bat batch file in Windows
  • A complete list of commonly used CMD commands in Windows XP system

<<:  Vue implements the full selection function

>>:  How to use CSS attribute selectors to splice HTML DNA

Recommend

Sample code for making a drop-down menu using pure CSS

Introduction: When I looked at interview question...

Creating private members in JavaScript

Table of contents 1. Use closures 2. Use ES6 clas...

How to configure the pdflatex environment in docker

Technical Background Latex is an indispensable to...

JavaScript immediate execution function usage analysis

We know that in general, a function must be calle...

Vue3.0 implements the encapsulation of the drop-down menu

Vue3.0 has been out for a while, and it is necess...

Three ways to check whether a port is open in a remote Linux system

This is a very important topic, not only for Linu...

CSS3 custom scroll bar style::webkit-scrollbar sample code detailed explanation

The default scroll bar style in Windows is ugly, ...

Summarize the commonly used nth-child selectors

Preface In front-end programming, we often use th...

Summary of methods for cleaning Mysql general_log

Method 1: SET GLOBAL general_log = 'OFF';...

How to use custom images in Html to display checkboxes

If you need to use an image to implement the use ...

Centering the Form in HTML

I once encountered an assignment where I was give...

Using MySQL database in docker to achieve LAN access

1. Get the mysql image docker pull mysql:5.6 Note...