I want to create a new mysql user with access some options in a mysql database.
This is my current create user query:
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
when i am running this code the server displays the following error message:
(Error: 1227 SQLSTATE: 42000 (ER_SPECIFIC_ACCESS_DENIED_ERROR)
Message: Access denied; you need the %s privilege for this operation)
Using MySQL Version 5.0.
Please help me to
The user you're currently logged in with doesn't have the rights to create new users. Log in with a different account that does.
the user that you are using to connect to the database and create the user doesn't has the privileges to create a new user. connect to the database with your administrator user
The thing is your connected to your database using a user that hasnt rights or priviledges to add additional users. First thing you needed to do is to connect with your root user or admin user in that case you can fully maximize all the priviledges to add,edit,delete,update,truncate,drop
but havings all this priviledges also you should know when to use them right because if not you will probably end up messing your database.
note : If your just a user who is given a specific user for used that has some priviledges lurking around and searching for ideas how you could possiblly broader your priviledges is not a good idea .Its better to ask you root admin to give you priviledges you need, instead of trying to create another one to bypass it.
You should login to the database using an admin or root account in order to create new users.
I believe the errors are incorrect in just about every case where there is a mismatch between the GRANT types, or GRANT levels the invoking user posesses, and those he is attempting to GRANT to another user.
There are the three steps
Create Database
Create new User
Give the rights with grant all command
like this
CREATE DATABASE DBTEST
IT THIS IS RUN SUCCESSFULLY WITH OUT ANY ERROR THEN CREATE NEW USER
CREATE USER 'NEWUSER'@'LOCALHOST' IDENTIFIED BY 'NEWUSERPASSWORD'
AFTER USER CREATION GIVE THE RIGHT OF CREATE TABLE DROP TABLE.....
GRANT ALL PRIVILEGES ON *.* TO 'NEWUSER'@'LOCALHOST'
AND AFTER ALL GIVE ONE COMMAND
FLUSH PRIVILEGES
YOU CAN ALSO GIVE THE RIGHTS ON PARTICULAR DATABASE LIKE THIS
GRANT ALL PRIVILEGES ON DBTEST.* TO 'NEWUSER'@'LOCALHOST'