Preface When you install MySQL, you usually create a superuser root. Many people continue to use this user. Although this is convenient, the superuser has too much authority, and using it everywhere is usually a security risk. This is similar to the user management of the operating system. Most people use the administrator or root user directly for convenience, which is actually not a recommended practice. So, how do you create a user other than root in MySQL and grant corresponding permissions? Let's look at an example directly: CREATE USER 'golden'@'localhost' IDENTIFIED BY 'gd2017'; GRANT ALL ON myapp.* TO 'golden'@'localhost'; FLUSH PRIVILEGES; Here is a brief analysis of the above statement: 1. The create user statement is used to create a user (and password). Here golden is the username and gd2017 is the password. localhost indicates a local user. 2. The grant statement is used to grant permissions to users. Among them, all means all permissions, including adding, deleting, modifying and checking data and changing the database; myapp is the name of a specific database, myapp.* means all tables (and views, etc.) under the database; golden is the user name just created. 3. The flush statement makes the changes effective. expand: Usually, the above settings can meet general needs. For more detailed configuration, please refer to the official online documentation of MySQL (version 5.7): https://dev.mysql.com/doc/refman/5.7/en/create-user.html https://dev.mysql.com/doc/refman/5.7/en/grant.html Summarize The above is the full content of this article. I hope that the content of this article can bring some help to your study or work. If you have any questions, you can leave a message to communicate. Thank you for your support of 123WORDPRESS.COM. You may also be interested in:
|
<<: Vue data two-way binding implementation method
>>: How to use boost.python to call c++ dynamic library in linux
MySQL paging queries are usually implemented thro...
Table of contents Lifecycle Functions Common life...
1. Simple configuration of nginx's dynamic an...
npx usage tutorial Tonight, when I was learning V...
Before, I had built WordPress myself, but at that...
Table of contents 1. Analysis of key source code ...
Table of contents Problem Description What is Vue...
Table of contents Question: 1. First attempt 2. R...
First, let's introduce a few key points about...
Table of contents 1. Mysql data structure 2. The ...
Table of contents MySQL federated query execution...
Table of contents Preface Setting up slow query l...
In a front-end technology group before, a group m...
Drop-shadow and box-shadow are both CSS propertie...
Table of contents 1. Overview of Docker consul 2....