6-11 database MySQL Initial

Source: Internet
Author: User
Tags mysql client

1, what is data?

 The symbolic records describing things are called data, and the symbols describing things can be either numbers or text, pictures, images, sounds, languages, etc., and the data is represented by many forms.
They can all be digitized and stored in a computer.

2, what is a database?

Data base is referred to as the warehouse in which DB is stored. But this warehouse is on the computer storage device, and the data is stored in a certain format.

In the past, people stored data in cabinets, and now the volume of data is large, no longer applicable.

Database is a long-term storage in the computer, organized, shareable data can be.

The data in the database is organized, described and stored in a certain data model, with small redundancy, high data independence and extensibility, and can be shared for various users.

The advantages are:

1. The amount of data stored is large.
2. Easy to manage.
3. Multi-user sharing.
4. Separate data sets.

3, what is Database Management system? Is the software that manages the data.

There are two main types of:

Relationship type: such as Sqllite,db2,oracle,access,sql server,mysql, note: SQL statement general non-relational type: Mongodb,redis,memcache
Can be simply understood as: relational database needs to have a table structure non-relational database is Key-value stored, no table structure

4, what is MySQL?

MySQL is a relational database management system developed by the Swedish MySQL AB company, currently owned by the Oracle company. MySQL's most popular relational database management system, MySQL is one of the best RDBMS (relational database Management system, relational databases management systems) application software in WEB applications. MySQL is a software based on the C/S architecture written by the socket.

Installation of 5,mysql

Some common commands in MySQL are:

Make a Windows service, initialize, mysqld--initialize-insecure automatically generate a data file in the directory.

Add environment variables,

Run as administrator: Mysqld--install

net start MySQL # open MySQL server

net stop MySQL # close the MySQL server

Open MySQL client: mysql-uroot-p The user who is currently logged on is root (with the highest privileges) default is no password

View Mysqld's process: tasklist |findstr MySQL

The process of killing mysqld first: taskkill/f/pid ' Process number '

Re-open MYSQLD server: net start MySQL

Stop process: net stop MySQL

Set new password: mysqladmin-uroot-p123 password 456

3. Skip authorization Form Reset Password (learn)
1. Run as administrator: net stop mysqld
2.mysqld--skip-grant-tables
3.mysql-uroot-p

Change Password
>update Mysql.user Set authentication_string =password (") where user= ' root ';

Create a new My.ini database configuration file under the data directory
Paste the following into the current file:

[MySQL]# Set the MySQL client default character setdefault-character-Set=UTF8[mysqld]# Set up the MySQL installation directory Basedir=D:\mysql-5.7. A-Winx64\mysql-5.7. A-Winx64 # Set the data storage directory for the MySQL database, it must be DataDir=D:\mysql-5.7. A-Winx64\mysql-5.7. A-winx64\data # mysql ports Port=3306# Character Set Character_set_server=UTF8 Sql_mode=No_engine_substitution,strict_trans_tables

The 6.mysql statement uses

1, Action folder (library)

Add create database db1 charset UTF8; creating a folder

View the currently created database show create databases db1;

View all databases Show databases

change ALTER DATABASE DB1 CharSet GBK;

Delete drop database db1;

2, Operation File table

Use DB1; Toggle Folder

Select Datanase (); View the folder you currently reside in

Increase

CREATE TABLE T1 (id int,name char); Add table

Check

View current table show create table T1;

View all tables show tables;

View the details of a table desc t1;

Change

Modify modified meaning ALTER TABLE t1 modify name char (6);

Change changes the meaning of ALTER TABLE T1, the name name char (7);

Delete tables drop table T1;

3, manipulate the contents of the file (record)

Increase

Insert inserts a data rule id,name etc. insert T1 (id,name) VALUES (1, "mjj01"), (2, "mjj02"), (3, "mjj03");

Check

Select keyword select name from db1.t1;

Select Id,name from Db1.t1;

SELECT * from Db1.t1; See all with * sign

Change

Update keyword set;

Update DB1.T1 Set name = ' Yuy ';

Update DB1.T1 Set name = ' Yuy ' where id = 3; You can add a specific condition where statement

Delete

Delete keyword

Delete ID from T1;

Delete from t1 where id = 2;

6-11 database MySQL Initial

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.