1. Create a new user. Login to MySQL
@>mysql-u root-p
@> Password
Create a user
mysql> mysql> INSERT INTO Mysql.user (host,user,password,ssl_cipher,x509_issuer,x509_sub
Ject values ("localhost", "pppadmin", Password ("passwd"), ', ', ', ', ');
This creates a user named: phplamp Password: 1234.
Then log in.
mysql>exit;
@>mysql-u phplamp-p
@> Enter password
Mysql> Login Successful
2. Authorize the user. Login to MySQL (with root privileges). I'm logged in as root.
@>mysql-u root-p
@> Password
First create a database for the user (phplampdb)
Mysql>create database phplampdb;
Authorize Phplamp users to have all the permissions of the Phplamp database.
>grant all privileges in phplampdb.* to phplamp@localhost identified by ' 1234 ';
Refresh System Permission Table
Mysql>flush privileges;
mysql> Other actions
/*
If you want to specify partial permissions to a user, you can write this:
Mysql>grant select,update on phplampdb.* to phplamp@localhost identified by ' 1234 ';
Refreshes the System permission table.
Mysql>flush privileges;
*/
3. Delete the user. @>mysql-u root-p
@> Password
Mysql>delete from user Where user= "phplamp" and host= "localhost";
Mysql>flush privileges;
Delete a user's database
Mysql>drop database phplampdb;
4. Modify the specified user password. @>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 Databases Mysql>use ' database name ';
7. List all Tables Mysql>show tables;
8. Display data table structure Mysql>describe table name;
9. Delete database and datasheet Mysql>drop database name;
Mysql>drop table datasheet name;
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.