MySQL build database and common functions

Source: Internet
Author: User
Tags create database

1. View database version information

Mysql> select version ();


2. View the database currently in use

Mysql> Select Database ();


3. View current logged in user

Mysql> Select User (), or Mysql>select current_user ();


4. See the current date, time, or time date

Mysql> select Curdate ();

Mysql> select Curtime ();

Mysql> Select Now ();


5. View the build statement, where Zabbix is the database name

Mysql> Show CREATE Database Zabbix;


6. View Character Set

Mysql> Show variables like "char%";


7. View the database engine, default to InnoDB

Mysql> show engines;


8. Set character Sets

mysql> set names UTF8;


9, the establishment of the database, where if not exists is determined that the database does not exist, if not exist, the creation of the presence of a warning message, but no error

Mysql> CREATE database if not EXISTS DB default character set UTF8;


10. Delete Database

mysql> drop Database DB;


Small question: How do I create a database named "Databases"?

MySQL build database and common functions

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.