Add "D:\mysql-5.6.22-winx64\bin" to the system environment variable path, and then in any directory can access MySQL and other commands, such as login and other operations do not need to enter the MySQL installation directory to perform!
MySQL Download (two):
Website: www.oracle.com
1) Download MySQL Community Server (GPL)---mysql database
2) MySQL Connectors---JDBC driver
Login: Mysql-u root-p1234
See which databases are available: show databases;
Open a database: use database name;
See which tables are in the Open database: show tables;
Dba:
Create a new User: Creation user Hncu identified by ' 1234 ';
Authorization to User: Grant all on * * to ' hncu ' @ '% ' with GRANT option;
※※※※ Note that after you create a new user, you can close and restart the MySQL server before it takes effect!
Common database Products: SQL Server, Oracle, MySQL
SQL language is not case sensitive
DDL (data definition language, Language)
Build libraries, build tables, set constraints, and more: Create\drop\alter
1. Create a database:
Create DATABASE IF not EXISTS hncu CHARACTER SET UTF8;
2. Create a table:
Use Hncu;
CREATE TABLE IF not EXISTS stud (
ID int,
Name varchar (30),
Age int
);
3. Change the table structure (set constraints)
DESC Stud; View table Structure
ALTER TABLE stud drop column age;
ALTER TABLE stud add column age int;
4. Delete a table, delete a database
drop table stud;
Drop database Hncu;
Ii. DML (Data manipulation language, manipulation Language)
Mainly refers to the deletion and modification of data: Select\delete\update\insert\call
SELECT * FROM stud;
Select Name,age from Stud; Querying the specified column
Select name as name, age as ages from stud;
※※ Remember: Table fields (field, table header) must be in English, if you want to display as a Chinese table header, with an alias to solve.
INSERT into stud values (2, ' Zhang San ', 22);
INSERT INTO stud (id,age) values (4,23); Specifies the assignment of field names, which is more efficient
Delete from stud where id=4;
Update stud set age = age+1; The age of all students plus 1
Import Script code
SOURCE D:\a\1.sql
CMD path
C:\Windows\System32
First day, MySQL installation, DDL (database definition Language), DBA,DML (Database manipulation language), import SQL file outside