MySQL Create user and authorization

Source: Internet
Author: User
Tags mysql create mysql backup mysql create user

Rights Management:

We know that our top authority manager is the root user, and it has the highest permissions. Includes select, Update, delete, update, Grant, and so on. So in general, after the company, the DBA engineer creates a user and password that allows you to connect to the database and set permissions (or all permissions) for an operation to the current user. Then we need to take a brief look at this:

    • How to create a user and password
    • Authorizing the current user
    • Remove permissions from the current user
Steps to create a new user:

1, go to MySQL database

MySQL> use mysqlDatabase changed

2, new users to increase the deletion

1. Create User: # Specify IP:192.118.1. 1 MJJ User LoginCreate User 'MJJ'@'192.118.1.1'Identified by '123'; # Specify IP:192.118.1. Beginning of MJJ User loginCreate User 'MJJ'@'192.118.1.%'Identified by '123'; # Specify MJJ user login for any IPCreate  Use 'MJJ'@'%'Identified by '123';2. Deleting usersDrop User 'User name'@'IP Address';3. Modify User RenameUser 'User name'@'IP Address'  to 'New user name'@'IP Address';4. Change PasswordSetPassword for 'User name'@'IP Address'=Password ('New Password');

For current user authorization management:

  

#查看权限show Grants for 'User'@'IP Address'#授权Grant Select,Insert,Update  onDb1.t1 to"MJJ" @'%', # Indicates a certain permission, except for Grant, which is the root of the command. Grant  All Privileges   onDb1.t1 to"MJJ" @'%'; #取消权限取消来自远程服务器的mjj用户对数据库db1的所有表的所有权限Revoke  All  onDB1.*  from 'MJJ'@"%"; Remove all tables from the remote server's MJJ user for all databasesRevoke  All Privileges  on '*'  from 'MJJ'@'%';

MySQL backup command line operation:
# Backup: Data table structure+Data Mysqdump-U root DB1>Db1.sql-p# Backup: Data table structure Mysqdump-U root-D DB1>Db1.sql-p# Importing existing data to a database #1. Create a new database firstCreate Databasedb10;#2. Import the existing database files into the DB10 database Mysqdump-U root-D DB10<Db1.sql-P

MySQL Create user and authorization

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.