18

when i am trying to log on mysql using my ip address i am getting error 1130 qht can i do for this

3 Answers 3

54

On your server run mysql from command line:

mysql -u root -p -h localhost -P 3306

Then run this command in mysql shell:

>use mysql
>GRANT ALL ON *.* to root@'%' IDENTIFIED BY 'yourpassword';
>FLUSH PRIVILEGES;

Have a nice time.

5
  • 1
    This one should be the best answer imo. Nice thing, this "%" :) Commented Aug 31, 2014 at 14:48
  • 2
    Except it is a bad advice security-wise. One should always use the most precise rule, here specifying the client IP address as a host or its NAT public IP, or a rule matching his DHCP subnet ('192.168.1.%" for example)
    – mveroone
    Commented May 3, 2016 at 7:59
  • It has been fixed my issue. Thanks a lot.
    – Yang Wang
    Commented Mar 26, 2017 at 23:18
  • 1
    osx's default mysql pkg was causing me a lot of trouble, this solves it.
    – user3905644
    Commented Oct 19, 2017 at 3:30
  • May 2018. Still applicable. Thank you. You may want to update the command due to Warning (Code 1287): Using GRANT statement to modify existing user's properties other than privileges is deprecated and will be removed in future release. Use ALTER USER statement for this operation.
    – jc__
    Commented May 18, 2018 at 17:38
14

Your client IP is not allowed to connect to this server, you must add it to allowed client account For exemple, assuming you add an user account having all rights in one database :

grant all on db.* to 'username'@'192.168.0.1';

Where db is database name, username the username , and your clients IP is 192.168.0.1

See docs for details of user account creation

1
  • 1
    this is SQL query to run on server with an account with enough privileges to do grant queries on the table
    – Benoit
    Commented May 18, 2010 at 14:10
0

On your server run mysql from command line:

mysql -u root -p -h localhost -P 3306 Then run this command in mysql shell:

use mysql

GRANT ALL ON . to root@'%' IDENTIFIED BY 'pass';

FLUSH PRIVILEGES;

Perfect! great steps and resolve the error Failure loading users data from backend [xx.xx.xx.x:3306] for service [Write Failover]. MySQL error 1130, Host

'xx.xx.xx.x' is not allowed to connect to this MariaDB server

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.