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
Table of contents Overview Defining filters Use o...
HTML code: <a onclick="goMessage();"...
Table of contents 1. Demand Background 2. Optimiz...
As more and more Docker images are used, there ne...
Red and pink, and their hexadecimal codes. #99003...
Preface Engineers working in the Linux environmen...
Table of contents Preface Demonstration effect HT...
Recently, when I installed MySQL in Docker, I fou...
With the increasing number of open platforms, the ...
Table of contents 1. Background 2. What is a virt...
In the development environment, the vue project i...
Problem to be solved Mainly for cross-level commu...
Take MySQL 5.7.19 installation as an example, fir...
Scenario 1. Maintain a citizen system with a fiel...
Yesterday when I was implementing the function of...