MySQL数据库管理常用命令小结_MySQL
bitsCN.com
MySQL数据库的管理对数据库来说是至关重要的一个环节,要想懂得MySQL数据库的管理必须从基础做起,只有先知道了数据库管理时使用的命令,实际操作起来就容易很多。下面就是MySQL数据库管理常用命令:
- 安装利用RPM包安装Mysql,设置TCP 3306端口的iptables。
- root密码管理设置root用户的密码mysqladmin -uroot password 'password'。
- 修改root用户的密码mysqladmin -uroot -p password 'password'。
- 数据库,表管理进入mysqlmysql -h hostname -uroot -p。
- 创建数据库mysql> create database location。
- 导入数据结构mysql -uroot -p location <.>查看数据库mysql> show databases;
- 进入某个库mysql> use location;
- 查看表信息mysql> show tables;
- 查看表结构mysql> desc Contact;
- 改表名mysql> rename table Contact to Contact_new。
- 删除库mysql> drop database location。
- 删除表mysql> drop table Contact。
- 授权部分建立用户并授权mysql> grant all on location.* to gk1020@'10.1.11.71' identified by 'gk1020'。
- 取消授权mysql> revoke all on location.* from gk1020@'10.1.11.71'。
- 刷新权限mysql> flush privileges。
- 操作语句查询mysql> select * from Contact。
- mysql> select count(*) from Contact。
- 修改mysql> update Contact set RegTime=‘2008-01-01 00:00:00' where id=1。
- mysql> update Contact set RegTime=‘2008-01-01 00:00:00',CID=1 where id=1。
- 插入mysql> insert into Contact values('',''…)
- mysql> insert into Contact(ID,CID,Contact) values('',''…)
- 删除mysql> delete from Contact where id=1。
- 导出导出数据库locationmysqldump -uroot -p location >./location.sql。
- 导出某个表mysqldump -uroot -p --database location --table Contact >./contact.sql。
- 导出数据库location的数据结构mysqldump -d -uroot -p location >./location.sql。
- 复制表复制表Contact为Contact_bakmysql> create table Contact_bak as select * from Contact。
- 复制表Contact的结构mysql> create table Contact_bak as select * from Contact where 1=2。
- 查看正在执行的任务mysql> show processlist。
特别说明:
location为库名,Contact为表名
大家就去理解这些MySQL数据库管理常用命令,并在实际操作中应用进去,熟练掌握,那么MySQL数据库管理常用命令就会易如反掌。
bitsCN.com
Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

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 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

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 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

MySQL is suitable for beginners because it is simple to install, powerful and easy to manage data. 1. Simple installation and configuration, suitable for a variety of operating systems. 2. Support basic operations such as creating databases and tables, inserting, querying, updating and deleting data. 3. Provide advanced functions such as JOIN operations and subqueries. 4. Performance can be improved through indexing, query optimization and table partitioning. 5. Support backup, recovery and security measures to ensure data security and consistency.

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

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

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
