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

An article to give you a deep understanding of Mysql triggers

Table of contents 1. When inserting or modifying ...

jQuery treeview tree structure application

This article example shares the application code ...

Detailed explanation of Docker data backup and recovery process

The data backup operation is very easy. Execute t...

How to restore single table data using MySQL full database backup data

Preface When backing up the database, a full data...

JavaScript anti-shake and throttling detailed explanation

Table of contents Debounce Throttle Summarize Deb...

What to do if the container started by docker run hangs and loses data

Scenario Description In a certain system, the fun...

Using JavaScript to implement carousel effects

This article shares the specific code for JavaScr...

Detailed tutorial on building a private Git server on Linux

1. Server setup The remote repository is actually...

JavaScript static scope and dynamic scope explained with examples

Table of contents Preface Static scope vs. dynami...

JavaScript implements the pot-beating game of Gray Wolf

1. Project Documents 2. Use HTML and CSS for page...

vue uses Ele.me UI to imitate the filtering function of teambition

Table of contents Problem Description The general...

A brief discussion on three methods of asynchronous replication in MySQL 8.0

In this experiment, we configure MySQL standard a...

Ubuntu 20.04 firewall settings simple tutorial (novice)

Preface In today's increasingly convenient In...