Home Database Mysql Tutorial MySQL数据库管理常用命令小结_MySQL

MySQL数据库管理常用命令小结_MySQL

Jun 01, 2016 pm 01:20 PM
Database management

bitsCN.com

MySQL数据库的管理对数据库来说是至关重要的一个环节,要想懂得MySQL数据库的管理必须从基础做起,只有先知道了数据库管理时使用的命令,实际操作起来就容易很多。下面就是MySQL数据库管理常用命令:

  1. 安装利用RPM包安装Mysql,设置TCP 3306端口的iptables。
  2. root密码管理设置root用户的密码mysqladmin -uroot password 'password'。
  3. 修改root用户的密码mysqladmin -uroot -p password 'password'。
  4. 数据库,表管理进入mysqlmysql -h hostname -uroot -p。
  5. 创建数据库mysql> create database location。
  6. 导入数据结构mysql -uroot -p location <.>查看数据库mysql> show databases;
  7. 进入某个库mysql> use location;
  8. 查看表信息mysql> show tables;
  9. 查看表结构mysql> desc Contact;
  10. 改表名mysql> rename table Contact to Contact_new。
  11. 删除库mysql> drop database location。
  12. 删除表mysql> drop table Contact。
  13. 授权部分建立用户并授权mysql> grant all on location.* to gk1020@'10.1.11.71' identified by 'gk1020'。
  14. 取消授权mysql> revoke all on location.* from gk1020@'10.1.11.71'。
  15. 刷新权限mysql> flush privileges。
  16. 操作语句查询mysql> select * from Contact。
  17. mysql> select count(*) from Contact。
  18. 修改mysql> update Contact set RegTime=‘2008-01-01 00:00:00' where id=1。
  19. mysql> update Contact set RegTime=‘2008-01-01 00:00:00',CID=1 where id=1。
  20. 插入mysql> insert into Contact values('',''…)
  21. mysql> insert into Contact(ID,CID,Contact) values('',''…)
  22. 删除mysql> delete from Contact where id=1。
  23. 导出导出数据库locationmysqldump -uroot -p location >./location.sql。
  24. 导出某个表mysqldump -uroot -p --database location --table Contact >./contact.sql。
  25. 导出数据库location的数据结构mysqldump -d -uroot -p location >./location.sql。
  26. 复制表复制表Contact为Contact_bakmysql> create table Contact_bak as select * from Contact。
  27. 复制表Contact的结构mysql> create table Contact_bak as select * from Contact where 1=2。
  28. 查看正在执行的任务mysql> show processlist。

特别说明:

location为库名,Contact为表名

大家就去理解这些MySQL数据库管理常用命令,并在实际操作中应用进去,熟练掌握,那么MySQL数据库管理常用命令就会易如反掌。

bitsCN.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How does the C++ function library perform database management? How does the C++ function library perform database management? Apr 18, 2024 pm 02:15 PM

The C++ function library can be used for database management. It provides a series of functions through header files to support operations such as connection, table creation, data insertion, query, and transaction processing. The library is suitable for managing common tasks of interacting with the database.

Laravel development: How to use Laravel Nova to manage databases? Laravel development: How to use Laravel Nova to manage databases? Jun 13, 2023 pm 06:40 PM

Laravel development: How to use LaravelNova to manage databases? LaravelNova is a brand new management system officially launched by Laravel, which can easily manage your database, reduce the time developers spend dealing with the management interface, and speed up the development process. This article will introduce how to use LaravelNova for database management. 1. Install LaravelNova Before starting, we need to install LaravelNova first. in terminal

How to use thinkorm to establish and manage database table relationships How to use thinkorm to establish and manage database table relationships Jul 28, 2023 pm 05:25 PM

How to use ThinkORM for relationship establishment and management of database tables Introduction: When developing web applications, the database is an indispensable part. The establishment and management of relationships between data tables is an important part of database design. ThinkORM is a powerful PHPORM library that provides a simple and intuitive operation interface that can help developers easily handle the relationships between database tables. This article will introduce how to use ThinkORM to establish and manage relationships between database tables, and attach relevant

Can PHP be used to develop and manage databases? Can PHP be used to develop and manage databases? Sep 11, 2023 am 08:16 AM

Can PHP be used to develop and manage databases? With the development of the Internet, the importance of databases has become increasingly prominent. A database is a software system used to store and manage large amounts of data and can provide efficient data retrieval and management functions. The use of databases is very common in website and application development. PHP is a scripting language that is widely used in web development and has the ability to process data. Therefore, PHP can be used not only to develop web pages and applications, but also to manage and operate databases. In PHP, commonly used

How to use php to extend SQLite for lightweight database management How to use php to extend SQLite for lightweight database management Jul 31, 2023 pm 03:33 PM

How to use PHP to extend SQLite for lightweight database management Introduction: SQLite is a lightweight embedded database engine that supports the creation and management of databases locally or in memory. It does not require any server and is very convenient to use. In PHP, we can use SQLite extensions to operate SQLite databases. This article will introduce how to use PHP to extend SQLite for lightweight database management and provide some code examples. Part One: Installing the SQLite Extension and SQL

Laravel development: How to use Laravel Migration to manage database migrations? Laravel development: How to use Laravel Migration to manage database migrations? Jun 13, 2023 pm 03:20 PM

In Laravel development, database management is a very important part. LaravelMigration provides a convenient way to manage database migration. Next, let us learn how to use LaravelMigration to manage database migration. What is LaravelMigration? LaravelMigration is a tool used to manage database migration. It can be used to record all modification operations on the database, including creation

Integration of PHP and database storage management Integration of PHP and database storage management May 17, 2023 pm 08:31 PM

With the development of the Internet, the business of modern enterprises has become increasingly dependent on computer support and management, and the importance of databases has become increasingly prominent. In this case, both enterprises and programmers inevitably need to use technical means of data storage management. As one of the most widely used scripting languages ​​on the Internet, PHP language has also attracted much attention for its application in database storage management. This article will focus on the integration of PHP and database storage management, analyzing its advantages and practical methods. 1. PHP language and database PHP language

Database capacity planning and management: MySQL design protocols that technical students should follow! Database capacity planning and management: MySQL design protocols that technical students should follow! Sep 10, 2023 am 09:10 AM

Database capacity planning and management: MySQL design protocols that technical students should follow! With the large-scale development of the Internet, the rapid growth of data volume has become a common problem. As a representative of relational database management systems, MySQL plays an important role in processing and managing massive data. However, without reasonable database capacity planning and management, MySQL's performance and stability will be seriously affected. Therefore, when designing a MySQL database, technical students should follow some design rules to ensure that the data

See all articles