MySQL5.7.14 download installation graphics and text tutorial and MYSQL database statement entry Encyclopedia _mysql

Source: Internet
Author: User
Tags mysql client create database

How to download:

I'll go to MySQL first. Download the latest version of mysql-Link: https://www.mysql.com/downloads/

Enter this interface to download:

Downloads–>mysql Community Edition (GPL) (This is free edition, of course, the rich can be charged, the function is more powerful) –>mysql Community Server (GPL)

–> Select the corresponding system and computer version (here, I choose the Window System 64-bit download)


–>no, just start my download.

How to install:

Because it is not installed, we download a good compression package, directly extract to the directory we want to install on it.

Create a new My.ini file and paste the following code (note: Basedir and DataDir are modified to their own installation path):

[MySQL]
# set MySQL client default character
Default-character-set=utf8
#设置3306端port = 3306
# set MySQL installation
basedir=d:\\ Mysql-5.7.14-winx64
# Set up MySQL database data storage
datadir=d:\\mysql-5.7.14-winx64\\data
# allow maximum connection
Max_ connections=200
# Server uses a character set that defaults to a 8-bit encoded latin1 character Character-set-server=utf8
# default Storage primer
to be used when creating new tables Default-storage-engine=innodb

Open the CMD Command window (run with Administrator privileges), go to the installation directory bin directory, and execute the command:

After the Mysqld–initialize-insecure–user=mysql carriage return, the Data folder has been created automatically under the MySQL installation directory.

The command line installs MySQL:

Register Service (note as administrator: Open "C:\Windows\System32" on my Computer, find the file "cmd.exe", right-click, select "Run as admin (A), go to Directory" D:\mysql-5.7.14-winx64 ", Then run the following code)

Bin\mysqld–install Mysql-5.7.14-winx64–defaults-file=d:\mysql-5.7.14-winx64\my.ini

Start the service (Run as Administrator)

net start mysql-5.7.14-winx64
– You can also right-click on "My Computer" | Manage "|" Service and Application "|" Service "| find" Mysql-5.7.14-winx64 ", right click to open, select Start

Command line login (the bin directory is set to the PATH environment variable, you can omit "bin\", followed by the same)

Bin\mysql-u root-p
– Press ENTER directly if the password is empty

Set the password for root (when the original password is empty): mysqladmin-u root password "1234"
5.7.14 version (after login with the root user MySQL) to modify the password for the 1234:set password for ' root ' @localhost = password (' 1234 ');

Modify root password: mysqladmin-u root password OldPassword "Newpass"

Stop the service (run as Administrator)

net stop mysql-5.7.14-winx64
– The service must be stopped before it can be deleted!

Delete Service (run as Administrator)

Bin\mysqld–remove mysql-5.7.14-winx64

Getting started with MySQL statements:

dcl– Data Control Language

This is typically done by DBAs (specialized database administrators), and we are programmers, and understand.

Create user Hncu identified by ' 1234 '; Create a user hncu password: 1234 
grant all in. to ' hncu ' @ '% ' with grant option;//authorize all resources to the user Hncu and allow him to log in using any machine

Grant all on. To ' Hncu ' @ ' 192.168.1.165 ' with GRANT option; Limit this user to only log on on this machine with IP: 192.168.1.1685

Demo with this Hncu login:

That's all it's about.

ddl– Data Definition Language Language

Building a library, building a table, setting constraints, etc.:

Create\drop\alter

There is a need to pay attention to the place: the difference between Char and Vaechar;

Knowledge points for data types: both char and varchar can be used to define fields of character types, distinguished by:

CHAR (15)-Fixed length 15, if assigned a value of only one character ' a ', then the data is: 1 characters ' a ' plus 14 spaces. -Compare a character array similar to Java.

varchar (15)--variable-length char array, if assigned only one character ' a ', then the inside data is only one character ' a '. -Compare a string similar to Java

If in some cases we have determined that the value of a parameter must be so long, we can use char.

Create database Hncu character set UTF8;
Create a database Hncu and set the encoding to Utf-8. The benefit of setting the encoding is to not rely on the default encoding in the configuration file.

If you write this:

 
 

[If not exists]– to determine if hncu exists and does not exist to create it.

The database we just created:

Use Hncu;
Enter the HNCU database.


CREATE TABLE Stud ( 
sno varchar () NOT NULL primary key, 
sname varchar (a) NOT NULL, age 
int 
); 
Create a table stud, containing 3 columns: Sno,sname,age. 
The not null-represents a non-null. 
Primary key-Set the primary key, that is SNO name must be unique!

DESC Stud;

Displays the structure of the stud table.

(This is for DDL) 
INSERT into stud values (' 1000 ', ' Jack ',); 
INSERT into stud values (' 1002 ', ' Tom ',); 
INSERT into stud values (' 1003 ', ' Rose ');/This sentence is wrong, not less! (followed by a method that specifies which columns to insert)
INSERT into stud values (' 1003 ', ' Rose ',); 
Add a row and assign a value to the stud table

Sno can be "", but there will only be one!

ALTER TABLE STUD ADD column Tel int;

Add a column with the type int for the stud table.

(values are null because they are not assigned)


ALTER TABLE stud DROP COLUMN Tel;

Delete the Tel column under the Stud table


drop table stud;

Delete Table Stud,

Drop database Hncu;

Delete Database Hncu,

dml-Data Manipulation Language manipulation Language

Mainly refers to the data of the deletion and modification

Select\delete\update\insert\call
show databases;//display all data names


Use Hncu; Open "Hncu" This database
show tables;//display all table names for the current database

SELECT * FROM stud;

Show all records in the stud table

SELECT * FROM stud where sname= ' Tom ';

Show (query) all records of Sname= ' Tom '

Select Sname,age from Stud;

Display the specified field (column) in the Stud table

INSERT into stud values (' 1004 ', ' John '); 
Insert a record into the stud table


Delete from stud where sname= ' Tom ';

Deletes the specified line-this is sname for Tom's line.


Update stud set sname= ' Dick ' where sno= ' 1003 ';

Modify the sname of the line Sno ' 1003 to ' Dick '


INSERT INTO stud (sno,sname) VALUES (' 1005 ', ' ronse ');

Inserts only the specified column. (set to NOT NULL must be set, can be set to ")

Basically learn these simple statements, slowly come, has been introduced!

The above is a small series to introduce the MySQL5.7.14 download installation graphics and text tutorial and MySQL database statement entry encyclopedia, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!

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.