MySQL authorization and status query

Source: Internet
Author: User
MySQL authorization and status query CREATEDATABASEodi; -- create an ODI database GRANTALLPRIVILEGESON *. * TOodi @

Create database odi for MySQL authorization and status query; -- CREATE an odi database grant all privileges on *. * TO odi @

MySQL authorization and status query

Create database odi; -- CREATE an ODI DATABASE
Grant all privileges on *. * TO odi @ '%' identified by 'odipasswd'; -- remote authorization;
Flush privileges; -- refresh the authorization table
Delete from user where user = "odi"; -- DELETE the USER authorization
Create database allen;


Grant all privileges on test. * TO odi @ '%' identified by 'odipasswd'; -- remote authorization
Grant all privileges on test TO odi @ '%' identified by 'odipasswd'; -- remote authorization
Grant all privileges on phplampDB. * TO phplamp @ localhost identified by '123 ';


-- Grant permission on database name. Table name user @ login host identified by "User Password ";
-- Grant permission on database name. Table name user @ login host identified by "User Password ";
-- Select host, user, password from user;
-- Update user set host = '%' where user = 'fang ';


Create database ccc;
Grant all privileges on ccc. * TO ccc @ '%' identified by 'cccpasswd'; -- remote authorization;
Flush privileges; -- refresh the authorization table


-- Create a user
Insert into mysql. user (HOST, USER, PASSWORD) VALUES ("%", "testdb", PASSWORD ("testpasswd "));
-- Create a new database
Create database testdb;
-- Authorize the test user to have all permissions for the testDB database (all permissions for a database)
Grant all privileges on testdb. * TO test @ localhost identified by 'testpasswd ';
-- Authorize the test user to have certain permissions on all databases
Grant select, DELETE, UPDATE, CREATE, drop on *. * TO test @ "%" identified by "1234 ";
-- Delete a user
Delete from user where user = 'test' and host = 'localhost ';
Flush privileges;
Drop database testDB; // delete a user's DATABASE
-- Delete an account and permissions:
Drop user username @ '% ';
Drop user username @ localhost;


-- Modify the password of a user
UPDATE mysql. user set password = PASSWORD ('new password') where user = "test" and host = "localhost ";
Flush privileges;


-- List all databases
Show databases;
-- Switch Database
USE database_name;
-- List all tables
Show tables;
-- Display table structure
DESCRIBE tables_name;
-- Delete a database
Drop database database_name;
-- Delete a data table
Drop table tables_name;

,

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.