MySQL Organizational structure

Source: Internet
Author: User
Tags mysql client

1. Organizational structure of the data
<1> Level type
<2> Mesh Type
<3> Relationship Type

2.mysql Package Format
<1> Package Manager-specific format:. RPM Package
<2> Generic binary package: Unzip play can be used
<3> source program: Source Package
3.mysql is the C/s architecture
client: MySQL package to install: MySQL
Server: Mysqld package to install: Mysql-server
the default is to listen on port 3306
It is generally run with MySQL user, MySQL group

4. After the disk format, the space is divided into two areas: a "metadata region", a "data region". Data regions are also partitioned into disk blocks.

5. After installation, enter in the client command line interface: MySQL will be able to access MySQL database.
########################################################################################
these are based on the process of installing the RPM package that comes with Red hat.

options for the 6.mysql command
-u Specifies the user name (root is the default, and this user is the root of MySQL.) Not a system. Its permissions are the highest)
-P (it is recommended that you do not enter the password after-p so everyone is visible and unsafe.) Enter the password directly by entering it in interactive mode)
- h Specifies the host

Change root password
First Change Password: mysqladmin-u root password ' 123123 ' Enter
Second Change password: mysqladmin-u root-p password ' 123123 ' Enter the original password
Note in the second command, after-p do not have spaces, direct access to the password can

There are two modes of 7.mysql client interaction
Interactive mode
batch processing mode (executes the MySQL script).

command categories in interactive mode:
client command:? or help get command assistance
server-side commands:
must use the statement terminator, which is the default semicolon
         
8. Relational database objects: libraries, tables, indexes, attempts, constraints, stored procedures, stored functions, triggers, cursors, users.

The 9.mysql library is actually the corresponding directory under/var/lib/mysql/.

10. Table
He's made up of rows and columns.
table: Also known as an entity
Line: Raw
Column: Field
    
we want to insert a data in the Web table, we need to define the field name, data type, type decoration.
    
Data type:
Character type:
CHAR
VARCHAR
BINARY
VARBINARY
TEXT
BLOB
    
Numeric Type:
Integral type:
Precise numerical type
Integral type
decimal
Approximate values:
floating Point Type

Date:
Boolean type:

One by one .
DDL: Defining the Data object's
command: CREATE ALTER DROP
DML: Operating language
command: INSERT updata DELETE
DCL: Control Language
command: GRANT REVOKE
These commands are case- insensitive

12. Operations related to libraries
format: Create database name;
See which libraries are available: show databases;
Creating a library: Create database pangbing;
Delete a database: Drop DB pangbing;
    
use MySQL: Indicates that the database is used, and the table is created in this library when the table is created without specifying a database.
Otherwise, when creating the table, use: CREATE table library name. Table name

13. Related Operations of the table
Format: Create table table name (field definition);
view tables in the default library: show tables;
view a table in a specific data: Show tables from library name;
view the structure of the table: Desc table name;
Delete tables: drop table name;
 
modifying tables: ALTER TABLE name;
There are several ways to modify this
MODIFY Modify a field (change the properties of the field, the name of the field does not change)
Change changes a field (field name change)
Add a field
Drop Delete Field

help ALTER TABLE: view assistance

14. Create mSQL users
create user ' username ' @ ' host ' identified by ' password '

example:mysql> create user ' pangbing ' @ ' 192.168.3.110 ' identified by ' 123 ';
//Upper IP address is the host address that is allowed to access
##############################################################    
Special Note: After authorized user rights, login must specify the login MySQL server
-H Login Server IP address login: mysql-u pangbing-h 192.168.3.110-p
##############################################################

Delete MySQL user
drop user ' username ' @ ' host '
Example: Drop user ' bing ' @ '% ';

15. Authorization to the User:
Note: If the user does not exist, an authorized user will be created automatically
GRANT permission list on library name. Table name to ' user name ' @ ' host address ' identified by ' password '

To cancel the authorization:

reovke permissions list on library name. Table name from ' username ' @ ' host address '

<1> Permissions list: Used to list the various database operations used by authorization, separated by commas
For example: Select Insert Updata. Use all privileges to represent all permissions and authorize any action.
<2>identified by: Used to set the user's password, if omitted at authorization, indicates that the password is empty.
<3> host Address: Which hosts are allowed to connect to the server or write IP (the address of the client)
'% ' stands for any host
Example: Grant all on the library name. * to ' pangbing ' @ '% ' identified by ' password '

16. View the list of permissions:
mysql> Show grants for ' pangbing ' @ '% ';
select User,host from Mysql.user;


17. By default, the root user does not have permission to Telnet, which is also based on security considerations;

mysql> Grant All privileges on * * to ' root ' @ '% ' identified by ' 123456 ' with Grant option;

18. View MySQL-supported engines
mysql> show engines;





MySQL Organizational structure

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.