MySQL Add user, delete user, authorization, change password and so on MySQL add user, new database, user authorization, delete user, change password
1. Create a new user.
Log in to MySQL
@>mysql-u root-p
@> Password
Create 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 with a password of: 1234.
Then log in.
mysql>exit;
@>mysql-u phplamp-p
@> Enter password
Mysql> Login Successful
2. Authorize the user.
Log in to MySQL (with root privileges). I am logged in as root.
@>mysql-u root-p
@> Password
First create a database for the user (phplampdb)
Mysql>create database phplampdb;
Authorizes the Phplamp user to have all the permissions of the Phplamp database.
>grant all privileges in phplampdb.* to [e-mail protected] identified by ' 1234 ';
Refresh System Permissions Table
Mysql>flush privileges;
Mysql> Other operations
/*
If you want to specify partial permissions to a user, you can write:
Mysql>grant select,update on phplampdb.* to [e-mail protected] identified by ' 1234 ';
Refreshes the System permissions 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. Switching the database
Mysql>use ' database name ';
7. List all Tables
Mysql>show tables;
8. Display the data table structure
Mysql>describe table name;
9. Deleting databases and data tables
Mysql>drop database name;
Mysql>drop table Data Sheet name;
Reprint: MySQL Add user, delete user, authorization, change password