MySQL Server 8.0 remote database

霸气de小男生 提交于 2019-12-16 18:07:13

问题


I am very frustrated that I am trying this from over 5 days. I need to create database on my PC that has to be visible for all other PCs in the same LAN.

I tried with XAMPP - Apache + MySQL - no result even after reading all articles from first 2 pages of Google and watching many youtube clips. Now I am trying with MySQL Server 8.0 on my PC. I tried again all of Google first pages stuff without result. How can I do that?

I know that this has been asked many times here but there is no complex solution at all.

Does anybody of you have tutorial that is tested nowadays and it is working?


回答1:


you should provide more details like the error message you get when connecting to the remote mysql server, anyway, to allow remote access, here is a checklist you need to go through:

  1. grant permission, mysql by default only allow access from localhost(127.0.0.1), to allow other ip access: // replace root for the username, '123456' for the password grant all privileges on . to 'root'@'%' identified by '123456';

    flush privileges;

  2. check your server firewall settings to allow your mysql through port 3306(default)

  3. others: for linux server I think you also need to comment out "bind address" in your mysql config file; some other issues for example your mysql client autodetect the wrong timezone, you may need to manually set it; check your inbound rule on your client pc; etc.

my suggestion for you, don't just google around blindly, think about it logically first, sometimes there is no direct answer




回答2:


The problem was in connection String.

static final String USERNAME="[username]"; static final String PASSWORD="[password]"; static final String CONN_STRING="jdbc:mysql://[ip-address]:[port]/[database-name]";

So as LIU YUE suggested I just granted access for this username. The problem was that my other computer has a different name.



来源:https://stackoverflow.com/questions/55060341/mysql-server-8-0-remote-database

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!