如何使用PHP代码在phpmyadmin中创建数据库来创建用户名和密码[关闭]

I have created database multiple and running SQL script in PHP code, but don't know how to create individual username and password of each database.

On the phpMyAdmin default page (localhost) click on the "Privileges" link 1. Click on the "Add a new User link" 2. Assign the User a login and password 3. Where it says "Database for User" select "None" 4. Leave all checkboxes in global privileges unchecked

Press the "Go" button You should see the new user in the User overview. Global privileges should say "Usage".

  1. Click on the edit icon next the the User's account
  2. Under "Database-specific privileges" where it says "Add privileges on the following
  3. database" chose the database(s) you wish to assign to the user
  4. Assign the User whatever privileges you wish them to have for that database
  5. Press the "Go" button

You can create a user and database by the name of matin11 with this code. you can change user name.

CREATE USER 'matin11'@'localhost';

GRANT ALL PRIVILEGES ON *.* TO 'matin11'@'localhost' REQUIRE NONE WITH GRANT OPTION MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0;

CREATE DATABASE IF NOT EXISTS `matin11`;

GRANT ALL PRIVILEGES ON `matin11`.* TO 'matin11'@'localhost';