简体   繁体   中英

Cannot connect remotelly to a mariadb server

I'm trying to connect to a mariadb server remotelly using terminal, but I get a little issue about that.

Preconditions

  • I have connection to my remote server, and I can enter inside maria db using the next command mysql -u root -p**** and I enter without problems.

  • Also I have commented this line of my.conf from the #bind-address = 127.0.0.1 .

When I'm trying to do this from my computer mysql -u root -h mariadb.testing.des -p**** I get the following error in console

ERROR 1045 (28000): Access denied for user 'root'@'mariadb.testing.des' (using password: YES)

Why am I getting two different results using the same user? What am I doing wrong?

Thanks for the help,

Jaster.

It's not enough to ensure your server is reachable from remote. You also have to create a user which has privileges for the remote access to your desired schema. I strongly recommend not to create a remote root user with access to all. Best practice is to create a remote user for every single scheme.

In example: CREATE USER 'jeffrey'@'my.remote.host' IDENTIFIED BY 'mypass'; GRANT ALL ON jeffreys_db.* TO 'jeffrey'@'my.remote.host';

See also: https://dev.mysql.com/doc/refman/5.7/en/create-user.html https://dev.mysql.com/doc/refman/5.7/en/grant.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM