Linux MySQL Add, delete users, user rights, and MySQL maximum number of fields

Source: Internet
Author: User

1. Login:

Mysql-u username-p

Show all databases:

show databases;

Use a database:

Use DatabaseName;

Show all tables for a database:

Show tables;

Exit:

Quit

deleting databases and data tables

Mysql>drop database name;

Mysql>drop table Data Sheet name;

User-Related: View all users: SELECT DISTINCT CONCAT (' User: ', user, ' @ ', host, '; ') as query from Mysql.user; New User:

CREATE USER ‘dog‘@‘localhost‘IDENTIFIED BY ‘123456‘

Authorization for User: Format: Grant permission on database. * to [email protected] Login host identified by "password"; Demo sample: Grant all privileges on testdb.* to [em AIL protected] identified by ' 1234 '; then you need to run the Refresh Permission command: Flush privileges; Grant users partial permissions: Grant Select,update on testdb.* to [email protected] identified by ' 1234 '; Grant certain permissions to a user for all databases: Grant Select,delete,update,create,drop on * * to [email protected] "%" identified by "1234"; Delete User: Delete from user Where user= ' test ' and host= ' localhost '; then refresh permissions; Delete account and permissions: >drop user [email protected] '% ';

>drop user [email protected] localhost; Change the specified user password

Log in with Root:
Mysql-u root-p
To run the command:
Update Mysql.user set Password=password (' New password ') where user= "test" and host= "localhost";
Refresh permissions:
Flush privileges; 2. mysql Maximum number of fields

Type

Size

Description

Cahr (Length)

Length byte

Fixed-length field, 0~255 characters

VARCHAR (Length)

String length + 1 bytes or string length + 2 bytes

Variable Length field, 0~65 535 characters long

Tinytext

String length + 1 bytes

string with a maximum length of 255 characters

TEXT

String length + 2 bytes

string with a maximum length of 65 535 characters

Mediumint

String length + 3 bytes

string with a maximum length of 16 777 215 characters

Longtext

String length + 4 bytes

string with a maximum length of 4 294 967 295 characters

TINYINT (Length)

1 bytes

Range: -128~127, or 0~255 (unsigned)

SMALLINT (Length)

2 bytes

Range: 32 768~32 767, or 0~65 535 (unsigned)

Mediumint (Length)

3 bytes

Range:-8 388 608~8 388 607, or 0~16 777 215 (unsigned)

INT (Length)

4 bytes

Range:-2 147 483 648~2 147 483 647, or 0~4 294 967 295 (unsigned)

BIGINT (Length)

8 bytes

Range:-9 223 372 036 854 775 808~9 223 372 036 854 775 807, or 0~18 446 744 073 709 551 615 (unsigned)

FLOAT (Length, decimals)

4 bytes

A smaller number with a floating decimal point

DOUBLE (Length, decimals)

8 bytes

A larger number with a floating decimal point

DECIMAL (Length, decimals)

length+1 bytes or length+2 bytes

A double that is stored as a string that allows a fixed decimal point

DATE

3 bytes

Use YYYY-MM-DD format

Datetime

8 bytes

Using YYYY-MM-DD HH:MM:SS format

TIMESTAMP

4 bytes

in YYYYMMDDHHMMSS format; acceptable range terminated in 2037

Time

3 bytes

Use HH:MM:SS format

Enum

1 or 2 bytes

Shorthand for enumeration (enumeration), which means that each column can have one of several possible values

SET

1, 2, 3, 4, or 8 bytes

Like an enum, except that each column can have multiple possible values

Linux MySQL Add, delete users, user rights, and MySQL maximum number of fields

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.