Mysql – Unable to access thesql database remotely

access-controlMySQLpermissions

I ran this command-

[root@dev-img mysql]# mysql -u root -h 192.168.1.181 -e "use mysql;"

and this is the output I got-

ERROR 1045 (28000): Access denied for user 'root'@'192.168.1.65' (using password: NO)

Is there anything wrong with my command? I've searched everywhere and the syntax seems to be as above.

Best Answer

Two possible problems

  1. You didn't specify the -p option. Without -p the client will not prompt for a password and will attempt to connect without one
  2. The database may not be configured to allow remote login for root. You may have to login on the server and enable remote access (i.e. GRANT ALL ON *.* TO root@'%' IDENTIFIED BY '...';)