首页 > 编程知识 正文

我的sql主机地址怎么填,如何查看mysql主机地址

时间:2023-05-04 18:56:25 阅读:106018 作者:3470

为了确认用户在访问软件之前是否在数据库中,需要通过“远程访问”从任意IP地址(来自自己的因特网的IP地址)连接到在线MySQL数据库

我在Linux终端上运行命令行,所有用户使用以下命令从任何ip地址中选择: grantallondatabase _ name.* to root @“%”identified by ' user

已配置MySQL数据库服务器配置文件以启用正确的远程连接。

位于/etc/MySQL/MySQL.conf.d/mysqld.cn f中的“MySQL数据库服务器配置文件”为:#

# themysqldatabaseserverconfigurationfile。

#

# You can copy this to one of:

#-'/etc/MySQL/my.cn f ' tosetglobaloptions,

#-'~/.my.cn f ' to setuser-specific options。

#

# onecanuseallongoptionsthattheprogramsupports。

# runprogramwith-- helptogetalistofavailableoptionsandwith

#-- defaultstoseewhichitwouldactuallyunderstandanduse。

#

# For explanations see

# http://dev.MySQL.com/doc/MySQL/en/server-system-variables.html

# thiswillbepassedtoallmysqlclient

# ithasbeenreportedthatpasswordsshouldbeenclosedwithticks/quotes

# escpeciallyiftheycontain ' # ' chars .

# remembertoedit/etc/MySQL/debian.cnfwhenchangingthesocketlocation。

# hereisentriesforsomespecificprograms

# thefollowingvaluesassumeyouhaveatleast 32m ram

[mysqld_safe]

socket=/var/run/mysqld/mysqld.sock

nice=0

[mysqld]

#

# *基本设置

#

user=mysql

PID-file=/var/run/mysqld/mysqld.PID

socket=/var/run/mysqld/mysqld.sock

端口=3306

basedir=/usr

datadir=/var/lib/mysql

tmpdir=/tmp

LC-messages-dir=/usr/share/MySQL

skip -外部锁定

#

# instead of skip-networkingthedefaultisnowtolistenonlyon

# localhostwhichismorecompatibleandisnotlesssecure。

mrdjdd-address=0.0.0.0

#require_secure_transport=on

#

# *精细调整

#

key_buffer_size=16M

max_allowed_packet=16M

thread_stack=192K

thread_cache_size=8

# thisreplacesthestartupscriptandchecksmyisamtablesifneeded

# the first time they are touched

myisam-recover-options=BACKUP

#max_connections=100

#table_open_cache=64

#thread_concurrency=10

#

# * Query Cache Configuration

#

query_cache_limit=1M

query_cache_size=16M

#

# *记录和复制

#

# bothlocationgetsrotatedbythecronjob。

# beawarethatthislogtypeisaperformancekiller。

# asof 5.1 youcanenablethelogatruntime!

# general _ log _ file=/var/log/MySQL/MySQL.log

#general_log=1

#

#错误日志- shouldbeveryfewentries。

#

log _ error=/var/log/MySQL/error.log

#

# hereyoucanseequerieswithespeciallylongduration

#slow_query_log=1

# slow _ query _ log _ file=/var/log/MySQL/MySQL-slow.log

#long_query_time=2

#log-queries-not-using-indexes

#

# thefollowingcanbeusedaseasytoreplaybackuplogsorforreplication

# note : ifyouaresettingupareplicationslave,see README.Debian about

# othersettingsyoumayneedtochange。

#server-id=1

# log _ Mr djd=/var/log/MySQL/MySQL-Mr djd.log

expire_logs_days=10

max_mrdjdlog_size=100M

# mrdjdlog _ do _ db=include _ database _ name

# mrdjdlog _ ignore _ db=include _ database _ name

#

# * InnoDB

#

# innodbisenabledbydefaultwitha 10 mbdatafilein/var/lib/MySQL /。

# readthemanualformoreinnodbrelatedoptions.there are many!

#

# *安全功能

#

# Read the manual,too,if you want chroot!

# chroot=/var/lib/mysql/

#

# forgeneratingsslcertificatesirecommendtheopensslgui ' tiny ca '。

#

# ssl-ca=/etc/mysql/cacert.pem

# SSL-cert=/etc/MySQL/server-cert.PEM

# SSL-key=/etc/MySQL/server-key.PEM

您还尝试使用以下命令行取消阻止防火墙并启用tcp连接:sudo ufw allow 3306/tcp

我的桌面APP应用程序的连接字符串如下。 MySQL conn.connectionstring=' server=my server IP address; 端口=3306; database=MyDatabaseName; uid=根; Pwd=MyPassword; Connect Timeout=30; SslMode=none;'

我的用户还“无法连接到指定的mysql主机”。 错误消息。 任何支持都欢迎。

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。