grant CREATE DATABASE permission PHP my admin

โœ… CORRECT FIX (DO THIS EXACTLY)

๐Ÿ”น Step 1: Stay logged in as root (you already are)

You should see:

mysql>

๐Ÿ”น Step 2: FIRST create the user

โš ๏ธ This step is mandatory

CREATE USER 'user1'@'localhost' IDENTIFIED BY 'StrongPassword@123';

โœ… If successful, youโ€™ll see:

Query OK, 0 rows affected

๐Ÿ”น Step 3: NOW grant CREATE DATABASE permission

GRANT CREATE ON *.* TO 'user1'@'localhost';
FLUSH PRIVILEGES;

๐Ÿ”น Step 4: (Optional but useful) Allow full DB control

GRANT ALL PRIVILEGES ON *.* TO 'user1'@'localhost';
FLUSH PRIVILEGES;

๐Ÿ”น Step 5: Verify

SHOW GRANTS FOR 'user1'@'localhost';

You MUST see:

GRANT CREATE ON *.*

๐Ÿ”น Step 6: Exit MySQL

EXIT;

โœ… FINAL STEP: phpMyAdmin

  1. Logout from phpMyAdmin

  2. Login again using:

    Username: user1
    Password: StrongPassword@123
  3. Open Databases

๐ŸŽ‰ โ€œNo Privilegesโ€ WILL BE GONE
๐ŸŽ‰ Create database option ENABLED


๐Ÿ” BEST PRACTICE (IMPORTANT)

For production servers:

  • โŒ Do NOT give ALL PRIVILEGES ON *.*

  • โœ… Give access only to required DB

Example (secure):

GRANT ALL PRIVILEGES ON mydb.* TO 'user1'@'localhost';

If you want, I can:

  • ๐Ÿ” Secure MySQL properly

  • ๐ŸŸข Create WordPress-ready DB & user

  • ๐Ÿงน Remove phpMyAdmin warnings

  • ๐Ÿ”’ Enable HTTPS (remove โ€œNot Secureโ€)

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top