mysql-Database Operations

Source: Internet
Author: User

Doc interface Operation Mysql:<br/>
Taking Phpstudy as an example
Login database: Enter Phpstudy/mysql/bin, mysql-u user name-p password
Select database: Use database name;
Set encoding format: set names GBK;
View table structure or field information: DESC table name;

CREATE DATABASE: Create database name Charset=utf8;
Delete the database: drop database name;
Modify database name: Export the database, create a new database, back up the database, or modify the database folder name under Mysql/data
Show all databases: show databases;

Build database tables: CREATE TABLE table name (field Name field type is blank (ID, set auto-grow, primary key), field Name 2 ...) Table Engine encoding format
Delete data table: drop table name;
Modify table name: ALTER TABLE name rename new table name;
View all tables: show tables;

Add Data table fields (columns): ALTER TABLE name add field name is empty;
Modify data table fields and field types is empty: ALTER TABLE name change old table name new table Name field type is empty;
Modify the Data table field type: ALTER TABLE name modify fields new data type
Delete data table fields: ALTER TABLE name drop field;

Insert data table data: INSERT into table name (field) VALUES (field corresponding value);
Delete data table data: Delete from table name (condition);
Empty data table: TRUNCATE TABLE name;
Modify the data table: The Update table name set field = new Value (where), and if not, all of the fields in the table have their values changed
View data table data: Select field name from table name (condition);

Database backup: Under Mysql/bin, command line: Mysqldump-u Username-p password database > file path and name after backup (e.g. E:/abc.sql)
Database restore: After logging into the database, create a new database and select the database, command line: Source file path to restore;

mysql-Database Operations

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.