MySQL Database basic operations

Source: Internet
Author: User

Basic operations of the database:

The SQL language is primarily used to store data, query data, update data, and manage relational database systems, developed by IBM and divided into 3 types of SQL language

DDL Database Definition language: Database, table, view, index, stored procedure keyword:create drop alter

DML Database Operation language: Adding and deleting changes to insert Delete Update Select

DCL Database Control Language: User access rights, security-level Grant revoke

 

System Database

INFORMATION_SCHEMA ( not stored on disk, is a virtual library )

It mainly stores the information of some database objects in the system, such as: User table information, column information, permission information, character information, etc.

Performance_schema

Performance parameters for primary storage databases

Mysql ( not before initialization )

Authorization Library, access information for primary storage system users

Test

Mysql Database system automatically created test database

forgot mysql password

#Vim/etc/my.cnf

"mysqld"

Skip-grant-table// plus this is skipping user authentication

#Service mysqld Restart

Mysql>select User,password, host from Mysql.user;

mysql>update Mysql.user Set Password=password ('[email protected]') where user='root' and host='Local host';

Mysql>flush Priviledes; Refresh Permissions

after changing the password, edit the master configuration file again and Skip-grant-table Erase or comment out

CREATE DATABASE database name

Principle:

write in case sensitive SQL statement.   

try to use The Unicode data type.   

prioritize using joins instead of subqueries or nested queries.

use parameterization as much as possible SQL query instead of statement stitching SQL query.   

Prohibit use [ Pinyin ]+[ english ] the way to name SQL object or variable.   

try to use stored procedures instead SQL Statements

CREATE DATABASE mysqldata; case-sensitive, unique, cannot use keywords, cannot use numbers alone , up to 128 bits, database is just a container for data, a database can be used to create tables

View database show databases;

Select database ();

Select database use database name

Delete the database name of the drop databases database;

Keywords are best capitalized, easy to read


This article is from "Happy Learning" blog, please be sure to keep this source http://983865387.blog.51cto.com/9838888/1917413

MySQL Database basic 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.