falcon
falcon

Reputation: 357

Grant privileges mysql server

I'm trying to grant privileges to my IP address for MySQL server. I don't know how can I say it exactly because of my english too, so please be patient.

xx.xxx.xxx.xx - My IP

CREATE USER 'root'@'xx.xxx.xxx.xx' IDENTIFIED BY 'password';
GRANT ALL ON *.* TO '[email protected]' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;

This error I got:

#1227 - Access denied; you need the CREATE USER privilege for this operation 

Could anyone help me please?

EDIT:

I made a command

SHOW GRANTS;

Grants for sukup-parkety@localhost
GRANT USAGE ON *.* TO 'sukup-parkety'@'localhost' IDENTIFIED BY PASSWORD 'somepassword'
GRANT ALL PRIVILEGES ON `sukup\_parkety`.* TO 'sukup-parkety'@'localhost' WITH GRANT OPTION

EDIT2: Ok, so I made other command

GRANT ALL ON sukup_parkety.* TO '[email protected]' IDENTIFIED BY 'mypassword';

But it reports the length error?

#1470 - String '[email protected]' is too long for user name (should be no longer than 16) 

Upvotes: 1

Views: 1867

Answers (2)

Aman Aggarwal
Aman Aggarwal

Reputation: 18449

Yes the exact query to grant is:

GRANT ALL ON sukup_parkety.* TO 'root'@'xx.xxx.xxx.xx' IDENTIFIED BY 'mypassword';

Just repeating already spoken and hoping for upvote.

Upvotes: 0

Jehad Keriaki
Jehad Keriaki

Reputation: 545

try 'root'@'xx.xxx.xxx.xx' instead of '[email protected]'

Upvotes: 3

Related Questions