MySQL / MariaDB

Modified on Thu, 15 May at 7:42 PM

Make a new user, new database and give the new user full permission to the new database:

-- Replace 'new_user', 'user_password', and 'new_database' with your desired values

-- Step 1: Create the user
CREATE USER 'new_user'@'%' IDENTIFIED BY 'user_password';

-- Step 2: Create the database
CREATE DATABASE new_database;

-- Step 3: Grant all privileges on the database to the user
GRANT ALL PRIVILEGES ON new_database.* TO 'new_user'@'localhost';

-- Step 4: Apply the changes
FLUSH PRIVILEGES;

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article