MySQL phpmyadmin 的连接 URL
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12294199/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Connection URL of phpmyadmin
提问by codeofnode
Can any body help me to get the connection url of the MySQL database on the server of phpmyadmin. I want to access the database remotely.
任何机构都可以帮助我获取phpmyadmin服务器上MySQL数据库的连接url。我想远程访问数据库。
Please note that the database is not on my local pc hard disk.
请注意,数据库不在我的本地电脑硬盘上。
Thank you.
谢谢你。
回答by Dhinakar
This is the connection URL for access Phpmyadmin MySql server:
这是访问 Phpmyadmin MySql 服务器的连接 URL:
Class.forName("com.mysql.jdbc.Driver");//Set driver
connection = (Connection) DriverManager.getConnection("jdbc:mysql://db_ip:3306/dbName",user_name, password);
//Get Connection
If you got below message:
如果您收到以下消息:
#1130 - Host 'machine name' is not allowed to connect to this MySQL server
Then you need to execute below query:
然后你需要执行以下查询:
CREATE USER 'root'@'%';
GRANT ALL PRIVILEGES ON * . * TO 'root'@'%' ;
GRANT ALL PRIVILEGES ON `root\_%` . * TO 'root'@'%';
This query creates the root user with all privilege and password is null.
此查询创建具有所有权限且密码为空的 root 用户。
Edit:
编辑:
This is the reference may help you:
这是参考可以帮助你: