从今天起无法通过 XAMPP 连接到本地 MY SQL 数据库 (mysqli_real_connect(): (HY000/2002))
Posted
技术标签:
【中文标题】从今天起无法通过 XAMPP 连接到本地 MY SQL 数据库 (mysqli_real_connect(): (HY000/2002))【英文标题】:Cannot connect to local MY SQL Database through XAMPP anymore since today (mysqli_real_connect(): (HY000/2002)) 【发布时间】:2020-03-09 07:58:01 【问题描述】:就在昨天,我正在处理这个 Wordpress 网页,一切正常。今天又回来了,就是连不上“设置无效,无法建立连接”。
这是我的 XAMPP 控制面板:
那些是 apache 设置:
$cfg['blowfish_secret'] = 'xampp'; /* YOU SHOULD CHANGE THIS FOR A MORE SECURE COOKIE AUTH! */
/*
* Servers configuration
*/
$i = 0;
/*
* First server
*/
$i++;
/* Authentication type and info */
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
$cfg['Lang'] = '';
/* Bind to the localhost ipv4 address and tcp */
$cfg['Servers'][$i]['host'] = '127.0.0.1';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
/* User for advanced features */
$cfg['Servers'][$i]['controluser'] = 'pma';
$cfg['Servers'][$i]['controlpass'] = '';
/* Advanced phpMyAdmin features */
$cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
$cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark';
$cfg['Servers'][$i]['relation'] = 'pma__relation';
$cfg['Servers'][$i]['table_info'] = 'pma__table_info';
$cfg['Servers'][$i]['table_coords'] = 'pma__table_coords';
$cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages';
$cfg['Servers'][$i]['column_info'] = 'pma__column_info';
$cfg['Servers'][$i]['history'] = 'pma__history';
$cfg['Servers'][$i]['designer_coords'] = 'pma__designer_coords';
$cfg['Servers'][$i]['tracking'] = 'pma__tracking';
$cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';
$cfg['Servers'][$i]['recent'] = 'pma__recent';
$cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs';
$cfg['Servers'][$i]['users'] = 'pma__users';
$cfg['Servers'][$i]['usergroups'] = 'pma__usergroups';
$cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding';
$cfg['Servers'][$i]['savedsearches'] = 'pma__savedsearches';
$cfg['Servers'][$i]['central_columns'] = 'pma__central_columns';
$cfg['Servers'][$i]['designer_settings'] = 'pma__designer_settings';
$cfg['Servers'][$i]['export_templates'] = 'pma__export_templates';
$cfg['Servers'][$i]['favorite'] = 'pma__favorite';
/*
* End of servers configuration
*/
?>
这是我的 SQL 配置:
[client]
# password =
port = 8080
socket = "C:/xampp/mysql/mysql.sock"
# Here follows entries for some specific programs
# The MySQL server
[mysqld]
port= 8080
socket = "C:/xampp/mysql/mysql.sock"
basedir = "C:/xampp/mysql"
tmpdir = "C:/xampp/tmp"
datadir = "C:/xampp/mysql/data"
pid_file = "mysql.pid"
# enable-named-pipe
key_buffer = 16M
max_allowed_packet = 1M
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
log_error = "mysql_error.log"
不幸的是,我离成为一名 Web 开发人员还很遥远,所以我无法理解其中的大部分内容。我尝试更改端口并关闭所有其他干扰的应用程序,但我无法再访问我的本地主机。
任何帮助都会很棒。
谢谢!
【问题讨论】:
不是mysql的默认端口3306? 这能回答你的问题吗? mysql said: Cannot connect: invalid settings. xampp @teeyo 谢谢!只需将端口更改为默认端口,即可使一切再次正常运行。发布为答案,我会接受:) 【参考方案1】:端口 8080 是一个网络端口,它可能被您的网络服务器使用。
改用默认端口:3306
【讨论】:
以上是关于从今天起无法通过 XAMPP 连接到本地 MY SQL 数据库 (mysqli_real_connect(): (HY000/2002))的主要内容,如果未能解决你的问题,请参考以下文章
curl 无法通过 ip static 连接本地 xampp
在 Win XP 64 位上,无法连接到 XAMPP 下的本地 apache 安装。帮助!