Mysql_ Notes 2018.1.28

Source: Internet
Author: User
Tags mysql code create database

1.Mysql Code Specification
1.关键字、函数名称大写2.数据库名称、表名称、字段名称等全部小写3.必须以分号;结尾  (或 \g)
2. Log MySQL Logs
开始记录mysql> \T 日志地址 日志文本名.txt结束记录mysql> \t
3. Create a Database
//简单创建CREATE DATABASE test1; //创建test1数据库//详细创建:查验无重名后再新建数据库,并指定编码格式create database if not exists maizi4 charcter set ‘GBK‘
4. View a list of databases, details of a database
全部数据库列表show databases;查看数据库详情(主要是编码格式、内容)show create database 数据库名; show create schema 数据库名;
5. Default Utf-8, modify the database encoding format
1.alter database 数据库名称 default character set utf8;2.alter database 数据库名称 default character set=utf8;
6. Open the Database
打开某个数据库use 数据库名;查看当前打开的数据库的列表select database();  //注意带() 那是个方法
7. Deleting a database
//直接删drop database 数据库名;//验证存在后再删drop database if exists 数据库名;
8. View warning Details
show warnings;
9. View the MySQL help manual
1.help tinyint      //查看tinyint的范围     2.? int         //查看int的范围3.\h create database //查看如何创建数据库
10. Several common database storage engines
//每次建表时可以根据存储格式选择不同的存储引擎,不同引擎支持的**不同。主要有:1.InnoDB存储引擎【默认轻轻功能强大,效率较低,支持并发、外键、回滚和修复,使用的最多】    ---常规---2.MyISAM存储引擎【插入记录快,默认静态(固定长度),不支持事物,对完整性、并发性支持弱】    ---读取快,完整性、并发性要求不高---3.MEMORY存储引擎【在内存中存储,读取快但耗内存;很少使用,一般不能建很大的表,多是一次性表】    ---临时表---
11. Data Storage Engine Query
查看支持的存储引擎 show engines;查看支持的存储引擎信息:show variables like ‘have%’查看默认的存储引擎:show variables like ‘storage_engine‘
12. Create a data table

Mysql_ Notes 2018.1.28

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.