1

I login into my VM login MySQL. I run:

mysql -u root -p
CREATE USER 'bheng'@'46.101.59.250' IDENTIFIED BY '**********';
GRANT ALL PRIVILEGES ON * . * TO 'bheng'@'46.101.59.250';
FLUSH PRIVILEGES;

I see this

select User,Host from mysql.user;

+------------------+---------------+
| User             | Host          |
+------------------+---------------+
| bheng            | 46.101.59.250 |
| cas              | localhost     |
| debian-sys-maint | localhost     |
| mysql.session    | localhost     |
| mysql.sys        | localhost     |
| root             | localhost     |
+------------------+---------------+

Then I tried to connect to my database as bheng user. I could not get in.

I kept getting this error:

Image

How can I resolve this?

3
  • 1
    I have the same problem here! Commented Mar 10, 2018 at 19:23
  • Let's start with the error: what's the exact error message? Commented Mar 11, 2018 at 9:51
  • This question had critical details removed from it in order to hide account details. Unfortunately all of those details were still available in the edit history, so there was not point in doing it. Moreover, the edit invalidated answers given below, and removed critical information, to the degree I would regard the edit as vandalism. Please do not do this. If you are worried about the security of your server, lock the user account named here and create a new one under a different name. Commented Jul 14, 2019 at 23:56

2 Answers 2

2

When you issue this partial command CREATE USER 'bheng'@'46.101.59.255' you instruct MySQL to allow the named user to log in from the machine at address 46.101.59.255. Is that the machine upon which MySQL runs? If so, you need to give your own machine's address. It seems unlikely this is your own machine's address, because it's registered to Digital Ocean.

Also, many hosting operators put firewalls on port 3306 (the MySQL connection port) to keep databases secure. Is this the case for your situation? If so, you should ask for help, or adjust your firewall. Be careful about opening up unencrypted connections to the public internet for your MySQL server: the public net is crawling with cybercreeps.

Sign up to request clarification or add additional context in comments.

2 Comments

How would one go about and access his own database via a remote DBMS client ?
Use an SSH connection instead @ihue. This is the common approach to tunnel a connection through an otherwise protected box.
1

Try execute this (only for test), and try again connect, if it works your IP is not '46.101.59.255', if does not work can be firewall:

UPDATE mysql.user SET host = '%' WHERE host != 'localhost';
FLUSH PRIVILEGES;

To check the ports being listened execute this command netstat -tuplen

Now, I will see my IP, because my problem is the IP adress.

1 Comment

I tried that, it still not let me in. but I got diff error, for sure.

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.