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

Detailed explanation of samba folder sharing server configuration under centos

1. Introduction Recently I found that there are m...

Multi-service image packaging operation of Dockerfile under supervisor

Writing a Dockerfile Configure yum source cd /tmp...

Book page turning effects made with CSS3

Result:Implementation code: html <!-- Please h...

How to use shell scripts in node

background During development, we may need some s...

Four ways to create objects in JS

Table of contents 1. Create objects by literal va...

MySQL multi-table join introductory tutorial

Connections can be used to query, update, and est...

JavaScript css3 to implement simple video barrage function

This article attempts to write a demo to simulate...

MySQL 8.0.18 installation and configuration method graphic tutorial

This article records the installation and configu...

Weather icon animation effect implemented by CSS3

Achieve results Implementation Code html <div ...

Complete steps to set up automatic updates in CentOS 8

The best thing you can do for your data and compu...

Detailed explanation of Mysql logical architecture

1. Overall architecture diagram Compared to other...

Solution to the conflict between two tabs navigation in HTML

Let's start with a description of the problem...

React uses emotion to write CSS code

Table of contents Introduction: Installation of e...

The use and methods of async and await in JavaScript

async function and await keyword in JS function h...

100-1% of the content on the website is navigation

Website, (100-1)% of the content is navigation 1....