Heim >Backend-Entwicklung >PHP-Tutorial >服务器经常提示mysql连接错误,有木有解决方法?

服务器经常提示mysql连接错误,有木有解决方法?

WBOY
WBOYOriginal
2016-06-06 20:52:431099Durchsuche

网络是联通的,因为在同一主机内,本地连接到mysql服务器,和运行环境无关,php,python连接数据库都有这种情况出现
提示

Can't connect to MySQL server on 'localhost'

下面是my.ini文件内容,已经省略注释

[client]
port=3306
[mysql]
default-character-set=utf8
[mysqld]
port=3306
basedir="E:/mysql/"
datadir="e:/mysql/data/"
default-character-set=utf8
default-storage-engine=MYISAM
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
max_connections=5000
query_cache_size=52M
table_cache=4100
tmp_table_size=64M
thread_cache_size=64
myisam_max_sort_file_size=100G
myisam_sort_buffer_size=80M
key_buffer_size=256M
read_buffer_size=64K
read_rnd_buffer_size=256K
sort_buffer_size=16M
skip-innodb
innodb_additional_mem_pool_size=2M
innodb_flush_log_at_trx_commit=1
innodb_log_buffer_size=1M
innodb_buffer_pool_size=8M
innodb_log_file_size=10M
innodb_thread_concurrency=18
wait_timeout=28800
thread_concurrency=4
skip-locking
log-slow-queries = slow.log
long_query_time = 1
max_connections = 1000
max_allowed_packet = 32M
interactive_timeout = 28800

回复内容:

网络是联通的,因为在同一主机内,本地连接到mysql服务器,和运行环境无关,php,python连接数据库都有这种情况出现
提示

Can't connect to MySQL server on 'localhost'

下面是my.ini文件内容,已经省略注释

[client]
port=3306
[mysql]
default-character-set=utf8
[mysqld]
port=3306
basedir="E:/mysql/"
datadir="e:/mysql/data/"
default-character-set=utf8
default-storage-engine=MYISAM
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
max_connections=5000
query_cache_size=52M
table_cache=4100
tmp_table_size=64M
thread_cache_size=64
myisam_max_sort_file_size=100G
myisam_sort_buffer_size=80M
key_buffer_size=256M
read_buffer_size=64K
read_rnd_buffer_size=256K
sort_buffer_size=16M
skip-innodb
innodb_additional_mem_pool_size=2M
innodb_flush_log_at_trx_commit=1
innodb_log_buffer_size=1M
innodb_buffer_pool_size=8M
innodb_log_file_size=10M
innodb_thread_concurrency=18
wait_timeout=28800
thread_concurrency=4
skip-locking
log-slow-queries = slow.log
long_query_time = 1
max_connections = 1000
max_allowed_packet = 32M
interactive_timeout = 28800

链接参数试一下 127.0.0.1

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn