Centos-based mysql learning Supplement 1: centosmysql Learning

Source: Internet
Author: User

Centos-based mysql learning Supplement 1: centosmysql Learning

Export the SQL script of a database in the mysql database-that is, import the structure and data of the database to an SQL script, and then restore the database through the SQL script.

Mysqldump-u mysql (User name: mysql)-pmysql (password: mysql) p2pserver (Database Name: p2pserver)> p2pserver. SQL (Script Name: p2pserver. SQL)

To export all database scripts

<Pre name = "code" class = "plain"> <pre name = "code" class = "cpp"> mysqldump-u mysql (username: mysql)-pmysql (password: mysql)-A> p2pserver. SQL (File Name: p2pserver. SQL)
 
 


Here is the SQL statement about wp_users:

DROP TABLE IF EXISTS `wp_users`;/*!40101 SET @saved_cs_client     = @@character_set_client */;/*!40101 SET character_set_client = utf8 */;CREATE TABLE `wp_users` (  `ID` bigint(20) unsigned NOT NULL AUTO_INCREMENT,  `user_login` varchar(60) NOT NULL DEFAULT '',  `user_pass` varchar(64) NOT NULL DEFAULT '',  `user_nicename` varchar(50) NOT NULL DEFAULT '',  `user_email` varchar(100) NOT NULL DEFAULT '',  `user_url` varchar(100) NOT NULL DEFAULT '',  `user_registered` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',  `user_activation_key` varchar(60) NOT NULL DEFAULT '',  `user_status` int(11) NOT NULL DEFAULT '0',  `display_name` varchar(250) NOT NULL DEFAULT '',  PRIMARY KEY (`ID`),  KEY `user_login_key` (`user_login`),  KEY `user_nicename` (`user_nicename`)) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;/*!40101 SET character_set_client = @saved_cs_client */;
What are the meanings of the two keywords primay key and KEY?

Primay key is the primary KEY to ensure data uniqueness;

KEY is an index constraint. It is used to restrict the index of fields in a table. Common keys include foreign keys. KEY is a keyword, which is unique in all records of each table. This item can be omitted in common tables. If this keyword is set, the query will be accelerated during Table query, but it will increase other burdens.



Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.