Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Summary of commonly used MySQL commands

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "the summary of commonly used MySQL commands". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn the "commonly used MySQL command summary" bar!

Launch: net start mySql

Enter: mysql-u root-p/mysql-h localhost-u root-p databaseName

List: show databases

Select database: use databaseName

List table: show tables

Display the properties of the table column: show columns from tableName

Set up the database: source fileName.txt

Matching characters: you can use the wildcard character _ to represent any character and% to represent any string

Add a field: alter table tabelName add column fieldName dateType

Add multiple fields: alter table tabelName add column fieldName1 dateType,add columns fieldName2 dateType

Multi-line command input: note that words cannot be disconnected; when inserting or changing data, the string of the field cannot be expanded into multiple lines, otherwise hard enter will be stored in the data

Add an administrator account: grant all on *. * to identified by "password"

Add a semicolon at the end of each statement after you have finished typing; or you can add g

Query time: select now ()

Query the current user: select user ()

Query database version: select version ()

Query the currently used database: select database ()

1. Delete the students table in the student_course database:

Rm-f student_course/students.*

2. Back up the database: (back up the database test)

Dump-u root-p test > c: est.txt

Backup table: (backup mytable table under test database)

Mysqldump-u root-p test mytable > c: est.txt

Import backup data into the database: (import back to test database)

Mysql-u root-p test

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report