相关疑难解决方法(0)

如何连接到另一台主机上的MySQL服务器?

Django的可以简单地通过设置连接到自己的MySQL服务器HOST,并PORTsettings.py为""(空字符串):

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
        'NAME': 'dbname',                   # Or path to database file if using sqlite3.
        'USER': 'root',                      # Not used with sqlite3.
        'PASSWORD': 'root',                  # Not used with sqlite3.
        'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
        'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
    }
}
Run Code Online (Sandbox Code Playgroud)

我的问题是如何使它能够连接另一台主机上的另一个数据库?假设我的机器192.168.1.33和另一台要连接的机器192.168.1.34都在同一个网络上.我试图将其设置为: …

mysql django database-connection

7
推荐指数
1
解决办法
2万
查看次数

标签 统计

database-connection ×1

django ×1

mysql ×1