Rumah > pembangunan bahagian belakang > tutorial php > 服务器经常提示mysql连接错误,有木有解决方法?

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

WBOY
Lepaskan: 2016-06-06 20:52:43
asal
1105 orang telah melayarinya

网络是联通的,因为在同一主机内,本地连接到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
Salin selepas log masuk
Salin selepas log masuk

回复内容:

网络是联通的,因为在同一主机内,本地连接到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
Salin selepas log masuk
Salin selepas log masuk

链接参数试一下 127.0.0.1

Label berkaitan:
sumber:php.cn
Kenyataan Laman Web ini
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
Tutorial Popular
Lagi>
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan