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.