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