`
qtlkw
  • 浏览: 307350 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

Remote connect to mysql database

阅读更多
1. mysql server installed on windows
if you want to connect the mysql server from the remote windows cliect,
you need to modify the user table of mysql database in mysql server, as follow:
update user set host = '%' where user = 'root';
or
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;(Note: password is root user's password)

if you want to connect to mysql server from a bind machine, you can execute the command:
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'192.168.1.8' IDENTIFIED BY 'mypassword' WITH GRANT OPTION;
so you can connect to mysql server from the 192.168.1.8 machine.

grant definition: grant rights on database's object to user
localhost: express you can login mysql server from localhost
%: express you can login from any machine in your network

2. mysql server installed on linux
  if you want to connect the mysql server from the remote windows client, please follow the 1 step above.
  if you can't login yet, you can modify the /etc/mysql/my.cnf file, remove or comment the "bind-address = 127.0.0.1" sentence,
  this sentence express the mysql server only listen to the localhost machine.
分享到:
评论

相关推荐

    Navicat Premium Enterprise Edition v10.0.10 + Keygen

    Navicat Premium is a multi-connections Database Administration tool allowing you to connect to MySQL, SQL Server, SQLite, Oracle and PostgreSQL databases simultaneously within a single application, ...

    connect-remote-database-demo

    这个项目"connect-remote-database-demo"显然是一个示例,旨在展示如何使用Java语言来实现这一功能。Java作为一种多平台、跨语言的编程工具,非常适合处理数据库连接。本项目的核心知识点主要包括以下几个方面: 1....

    mysql-connector-java-5.1.47.jar

    MySQL Connector/J是按照Java Database Connectivity (JDBC) API规范实现的,这是一个由Sun Microsystems(现为Oracle公司)定义的标准接口,用于在Java应用和各种数据库之间建立连接。JDBC允许Java开发者编写与...

    php+mysql留言板系统「完整代码及详解」.docx

    $conn = mysql_connect($mysql_server_name, "root", "123456"); mysql_select_db("gbook"); $sql = "INSERT INTO `gbook` (`id`, `name`, `sex`, `email`, `info`, `ip`, `time_at`) VALUES (NULL, '$name', '$sex...

    [php]mysql数据库操作——DB类

    else $this->conn=mysql_connect($this->host,$this->user,$this- >pass); // 临时链接 if (!$this->conn) $this->show_error('无法连接服务器'); $this->select_db($this->data); $this->query('SET NAMES '.$...

    Oracle-不同数据库DBLINK导数据使用说明

    CONNECT TO remote_user IDENTIFIED BY remote_password USING 'remote_database_connect_string'; ``` 例如,如果要从本地数据库连接至名为ORCL的远程数据库,可以使用以下命令: ```sql CREATE DATABASE LINK ...

    node-tcp-server:Node.js 中的一个简单 TCP 服务器,用于将接收到的数据写入 MySQL 数据库

    console.log('新连接建立:', socket.remoteAddress + ':' + socket.remotePort); socket.on('data', (data) => { console.log('接收到数据:', data.toString()); // 在这里处理数据并将数据保存到MySQL }); ...

    Hive2.3.4安装文档

    Used by metastore client to connect to remote metastore. <!-- 元数据使用mysql数据库 --> <name>javax.jdo.option.ConnectionURL <value>jdbc:mysql://bigdata01:3306/hive?createDatabaseIfNotExist=...

    PHP在线人数统计.pdf

    使用了MySQL_connect()函数来建立数据库连接。这个函数需要三个参数:数据库服务器地址($server),数据库用户名($db_user),和数据库密码($db_pass)。连接成功后,使用数据库名($database)来选择数据库。 3...

    java编写门禁系统

    可以使用Java的JDBC(Java Database Connectivity)接口来连接和操作数据库,如MySQL或Oracle。数据库中应包含用户信息(如ID、姓名、权限等级)、门禁记录(进出时间、地点)等表。ORM(Object-Relational Mapping...

    对python 通过ssh访问数据库的实例详解

    'mysql://%s:%s@127.0.0.1:%d/%s' % (databaseA_usr, databaseA_pwd, server.local_bind_port, databaseA_db) ) # 在这里使用destination_lib进行数据库操作 server.close() ``` 总结来说,Python通过SSH访问...

    坏狼php学习 计数器实例代码

    $conn = mysql_connect($mysql_server_name, $mysql_username, $mysql_password); // 准备SQL语句 - 新增数据 $sql = "INSERT INTO `num` (`name`, `ip`, `new`) VALUES ('badwolf', '$ip', '1')"; // 选择要操作...

    HIVE 0.12安装配置(HADOOP2.2)

    <description>Username to use against metastore database <name>javax.jdo.option.ConnectionPassword <value>your_password <description>Password to use against metastore database ``` **5. 初始化...

    ADO连接字符串大全[归类].pdf

    - ODBC Driver for MySQL:连接到MySQL数据库。 - ODBC Driver for Oracle:连接到Oracle数据库。 - ODBC Driver for SQL Server:连接到Microsoft SQL Server。 2. ODBC DSN-Less Connections(无DSN连接): ...

    ado连接字符串大全

    SERVER=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));UID=myuser;PWD=mypassword;"; ``` - **ODBC Driver for Paradox**: 连接...

    PHP项目报告.pdf

    3. **数据库连接和操作**:文档中提到了mysql_connect()函数,这是PHP中用于连接MySQL数据库的函数。还提到了mysql_query()函数,用于执行SQL查询。这些是PHP与MySQL数据库交互的基础技术。 4. **数据库设计和SQL...

    [没问题] Perl找到要存储到数据库中的客户端网络速度

    Perl可以使用多种数据库接口模块,如DBI(Database Interface)来连接和操作MySQL、SQLite、PostgreSQL等数据库。以下是一个使用DBI模块的例子: ```perl use DBI; my $db_name = 'network_speeds'; my $db_user =...

    jQuery+Ajax+PHP“喜欢”评级功能实现代码

    // Connect to database // ... $id = intval($_POST['id']); $ip = $_SERVER['REMOTE_ADDR']; // Check if IP exists in pic_ip $query = "SELECT * FROM pic_ip WHERE ip='$ip' AND pic_id='$id'"; $result = ...

    IP得到地级市城市名(PHP版)

    $conn = new mysqli('localhost', 'username', 'password', 'database'); if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } $query = "SELECT city FROM iptocity WHERE ip...

Global site tag (gtag.js) - Google Analytics