Posted By Shahid Malla

How to Create a User and Grant All Permissions in MySQL on Ubuntu - Shahid Malla - WHMCS Expert Freelancer

You can create a new user and grant all privileges on a specific database in MySQL using the following steps:

  1. Log in to your MySQL server as a user with administrative privileges using the following command
    sudo mysql -u root -p This will prompt you to enter the MySQL root password.
  2. Create a new user by running the following SQL command:
    CREATE USER 'shahid'@'localhost' IDENTIFIED BY 'password'; Replace new_user with the desired username and password with the desired password.
  3. Grant all privileges on the shahid database to the new user by running the following SQL command:
    GRANT ALL PRIVILEGES ON shahid.* TO 'new_user'@'localhost';
    This will grant all privileges on the shahid database to the user new_user from the localhost host.
  4. Reload the privileges by running the following SQL command:

    FLUSH PRIVILEGES; This will reload the privileges and make the changes take effect immediately.

If any syntax error then run! these commands

CREATE USER ‘shahid’@’localhost’ IDENTIFIED BY ‘shahidpassword321!!!@#’;

GRANT ALL PRIVILEGES ON *.* TO ‘shahid’@’localhost’;

FLUSH PRIVILEGES;

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x