Introduction to adding new users to MySql, creating databases for users, and assigning permissions to users

Introduction to adding new users to MySql, creating databases for users, and assigning permissions to users

1. Add a new user

Only allow local IP access

create user 'test'@'localhost' identified by '123456';

Allow external IP access

create user 'test'@'%' identified by '123456';

Refresh Authorization

flush privileges;

2. Create a database for the user

create database test DEFAULT CHARSET utf8 COLLATE utf8_general_ci;

3. Assign permissions to users

Grant users all permissions to operate the database through the external IP

grant all privileges on `testdb`.* to 'test'@'%' identified by '123456';

Grant users permission to operate all databases through external IP

grant all privileges on *.* to 'test'@'%' identified by '123456';

Refresh Authorization

flush privileges;

This is the end of this article about how to add new users in MySql, create databases for users, and assign permissions to users. For more information about how to add new users in MySql, create databases for users, and assign permissions to users, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • How to create a MySQL database and support Chinese characters
  • Mysql anonymous login cannot create a database problem solution
  • mysql create database, add users, user authorization practical method
  • Two ways to create a MySQL database
  • Create database and database table code with MySQL
  • Example of creating a database using PHP
  • Create database php code and write your own BLOG system with PHP
  • PHP Desktop Center (I) Creating a database
  • MySQL and PHP basics and application topics: creating database tables

<<:  Implementation of nested jump of vue routing view router-view

>>:  Vue implements a small countdown function

Recommend

A brief analysis of the difference between FIND_IN_SET() and IN in MySQL

I used the Mysql FIND_IN_SET function in a projec...

HTML meta viewport attribute detailed description

What is a Viewport Mobile browsers place web pages...

Deeply understand how nginx achieves high performance and scalability

The overall architecture of NGINX is characterize...

Practical TypeScript tips you may not know

Table of contents Preface Function Overloading Ma...

Detailed tutorial on installing Python 3 virtual environment in Ubuntu 20.04

The following are all performed on my virtual mac...

Vue implements chat interface

This article example shares the specific code of ...

Mysql date formatting and complex date range query

Table of contents Preface Query usage scenario ca...

HTML Learning Notes--Detailed Explanation of HTML Syntax (Must Read)

1. What is HTML markup language? HTML is a markup...

Detailed explanation of JS ES6 coding standards

Table of contents 1. Block scope 1.1. let replace...

Let's talk about the difference between MyISAM and InnoDB

The main differences are as follows: 1. MySQL use...

JavaScript file loading and blocking issues: performance optimization case study

Let me start with a question: When writing an HTM...