How to set MySQL permissions for your site using PHPMyAdmin

MySQL is a commonly used relational database management system, and PHPMyAdmin is a widely used web interface tool for managing MySQL databases. In PHPMyAdmin, you can set different users' access rights to the database. This article will introduce how to use PHPMyAdmin to set MySQL permissions for the site and provide corresponding source code examples.

Step 1: Log in to PHPMyAdmin
First, you need to log in to PHPMyAdmin. Enter your PHPMyAdmin URL in a web browser and log in with a valid username and password.

Step 2: Select Database
On the main interface of PHPMyAdmin, you will see the databases listed. Select the database for which you want to set permissions. Click the name of the database.

Step 3: Select the "Permissions" tab
At the top of the database page, you will see multiple tabs such as "Browse", "Structure", "SQL", etc. Select the tab called "Permissions."

Step 4: Create a new user
On the Permissions tab, you will see an "Add new user" link. Click the link to create a new user.

Step 5: Fill in the user details
On the page to create a new user, you need to provide the following details:

  • Username: Enter the username you want to create.
  • Host: Select the host that is allowed to access the database. If you want this user to be able to access the database from any host, select the Any Host option.
  • Password: Enter the user's password.
  • Password options: Choose how your password is encrypted. It is recommended to select the default "Use MySQL native password".

Step 6: Set User Permissions
On the lower half of the page, you will see a section called "Permissions." Here you can choose different permission levels for your users. Depending on your needs, select or deselect the appropriate permissions checkboxes.

Here are some commonly used permission options:

  • SELECT: Allow user

Guess you like

Origin blog.csdn.net/wellcoder/article/details/133506714