Mysql record and mysql record

Source: Internet
Author: User

Mysql record and mysql record

1. Create a USER command:

<! ----> Mysql> create user yy identified by '20160301 ';

Yy indicates the username you want to create, and 123 indicates the password.

The user created above can log in anywhere.

If you want to restrict Logon at a fixed address, such as localhost Logon:

<! ----> Mysql> create user yy @ localhost identified by '20140901 ';

2. grant permissions:

<! ----> Mysql> grant all privileges on *. * TO user; @ localhost <! ----> Grant select, insert, update, delete on *. * to test1 @ "%" Identified by "abc ";

Grant select, insert, update, delete on *. * to test1 @ "%" Identified by "abc ";

Format: grant select on database. * to username @ login host identified by "password"

Change Password:

<! ----> Mysql> grant all privileges on pureftpd. * to koko @ localhost identified by 'mimimi ';

Flush:

<! ----> Mysql> flush privileges;

View user information:

<! ----> Mysql> select host, user from mysql. user; 3. delete a user.
@> Mysql-u root-p
@> Password
Mysql> delete from user WHERE User = "phplamp" and Host = "localhost ";
Mysql> flush privileges;
// Delete the user's database
Mysql> drop database phplampDB;

4. Modify the password of the specified user.
@> Mysql-u root-p
@> Password
Mysql> update mysql. user set password = password ('new password') where User = "phplamp" and Host = "localhost ";
Mysql> flush privileges;
5. list all databases
Mysql> show database;
6. Switch the database
Mysql> use 'database name ';
7. list all tables
Mysql> show tables;
8. display the data table structure
Mysql> describe table name;
9. Delete databases and data tables
Mysql> drop database name;
Mysql> drop table data table name;

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.