XAMPP中的MySQL数据库已停止

时间:2016-01-22 18:39:42

标签: mysql xampp

我正在Linux上运行Xampp(Ubuntu 14.04),虽然一切正常,直到我关闭它一小时后它突然开始抛出这个错误。 错误的:

  MySQL说:文档       无法连接:无效设置。       配置中定义的controluser连接失败。       phpMyAdmin尝试连接到MySQL服务器,服务器拒绝连接。您应该检查配置中的主机,用户名和密码,并确保它们与MySQL服务器管理员提供的信息一致。

错误消息的图片: Error Message

我的config.inc.php:

<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
 * phpMyAdmin sample configuration, you can use it as base for
 * manual configuration. For easier setup you can use setup/
 *
 * All directives are explained in documentation in the doc/ folder
 * or at <http://docs.phpmyadmin.net/>.
 *
 * @package PhpMyAdmin
 */

/*
 * This is needed for cookie based authentication to encrypt password in
 * cookie
 */
$cfg['blowfish_secret'] = 'xampp'; /* YOU SHOULD CHANGE THIS FOR A MORE SECURE COOKIE AUTH! */

/*
 * Servers configuration
 */
$i = 0;

/*
 * First server
 */
$i++;
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'brahim';
$cfg['Servers'][$i]['password'] = '';
/* Server parameters */
//$cfg['Servers'][$i]['host'] = 'localhost';
//$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = true;
$cfg['Servers'][$i]['AllowNoPassword'] = true;

/*
 * phpMyAdmin configuration storage settings.
 */

/* User used to manipulate with storage */
// $cfg['Servers'][$i]['controlhost'] = '';
// $cfg['Servers'][$i]['controlport'] = '';
$cfg['Servers'][$i]['controluser'] = 'pma';
$cfg['Servers'][$i]['controlpass'] = '';

/* Storage database and tables */
$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]['table_uiprefs'] = 'pma__table_uiprefs';
$cfg['Servers'][$i]['tracking'] = 'pma__tracking';
$cfg['Servers'][$i]['userconfig'] = 'pma__userconfig';
$cfg['Servers'][$i]['recent'] = 'pma__recent';
// $cfg['Servers'][$i]['favorite'] = 'pma__favorite';
// $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';
/* Contrib / Swekey authentication */
// $cfg['Servers'][$i]['auth_swekey_config'] = '/etc/swekey-pma.conf';

/*
 * End of servers configuration
 */

/*
 * Directories for saving/loading files from server
 */
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';

/**
 * Whether to display icons or text or both icons and text in table row
 * action segment. Value can be either of 'icons', 'text' or 'both'.
 */
//$cfg['RowActionType'] = 'both';

/**
 * Defines whether a user should be displayed a "show all (records)"
 * button in browse mode or not.
 * default = false
 */
//$cfg['ShowAll'] = true;

/**
 * Number of rows displayed when browsing a result set. If the result
 * set contains more rows, "Previous" and "Next".
 * default = 30
 */
//$cfg['MaxRows'] = 50;

/**
 * disallow editing of binary fields
 * valid values are:
 *   false    allow editing
 *   'blob'   allow editing except for BLOB fields
 *   'noblob' disallow editing except for BLOB fields
 *   'all'    disallow editing
 * default = blob
 */
//$cfg['ProtectBinary'] = 'false';

/**
 * Default language to use, if not browser-defined or user-defined
 * (you find all languages in the locale folder)
 * uncomment the desired line:
 * default = 'en'
 */
//$cfg['DefaultLang'] = 'en';
//$cfg['DefaultLang'] = 'de';

/**
 * How many columns should be used for table display of a database?
 * (a value larger than 1 results in some information being hidden)
 * default = 1
 */
//$cfg['PropertiesNumColumns'] = 2;

/**
 * Set to true if you want DB-based query history.If false, this utilizes
 * JS-routines to display query history (lost by window close)
 *
 * This requires configuration storage enabled, see above.
 * default = false
 */
//$cfg['QueryHistoryDB'] = true;

/**
 * When using DB-based query history, how many entries should be kept?
 *
 * default = 25
 */
//$cfg['QueryHistoryMax'] = 100;

/**
 * Should error reporting be enabled for JavaScript errors
 *
 * default = 'ask'
 */
//$cfg['SendErrorReports'] = 'ask';

/*
 * You can find more configuration options in the documentation
 * in the doc/ folder or at <http://docs.phpmyadmin.net/>.
 */

cfg['Servers'][$i]['auth_type']更改为'cookie'时,他又遇到了另一个问题:

  

无法登录MySQL服务器        配置中定义的controluser连接失败。

日志错误:

2016-01-23 06:37:42 8648 mysqld_safe mysqld from pid file /opt/lampp/var/mysql/DrBrm.pid ended
2016-01-23 20:31:06 2900 mysqld_safe Starting mysqld daemon with databases from /opt/lampp/var/mysql
2016-01-23 20:31:07 0 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
2016-01-23 20:31:07 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-01-23 20:31:07 0 [Note] /opt/lampp/sbin/mysqld (mysqld 5.6.26) starting as process 3247 ...
2016-01-23 20:31:07 3247 [Note] Plugin 'FEDERATED' is disabled.
2016-01-23 20:31:07 3247 [Note] InnoDB: Using atomics to ref count buffer pool pages
2016-01-23 20:31:07 3247 [Note] InnoDB: The InnoDB memory heap is disabled
2016-01-23 20:31:07 3247 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-01-23 20:31:07 3247 [Note] InnoDB: Memory barrier is not used
2016-01-23 20:31:07 3247 [Note] InnoDB: Compressed tables use zlib 1.2.8
2016-01-23 20:31:07 3247 [Note] InnoDB: Using CPU crc32 instructions
2016-01-23 20:31:07 3247 [Note] InnoDB: Initializing buffer pool, size = 16.0M
2016-01-23 20:31:07 3247 [Note] InnoDB: Completed initialization of buffer pool
2016-01-23 20:31:07 3247 [Note] InnoDB: Highest supported file format is Barracuda.
2016-01-23 20:31:07 3247 [Note] InnoDB: The log sequence numbers 1624742 and 1624742 in ibdata files do not match the log sequence number 1682069 in the ib_logfiles!
2016-01-23 20:31:07 3247 [Note] InnoDB: Database was not shutdown normally!
2016-01-23 20:31:07 3247 [Note] InnoDB: Starting crash recovery.
2016-01-23 20:31:07 3247 [Note] InnoDB: Reading tablespace information from the .ibd files...
2016-01-23 20:31:07 3247 [ERROR] InnoDB: Attempted to open a previously opened tablespace. Previous tablespace myshop/client_compte uses space ID: 10 at filepath: ./myshop/client_compte.ibd. Cannot open tablespace myshop/mobile12 which uses space ID: 10 at filepath: ./myshop/mobile12.ibd
2016-01-23 20:31:07 7f8b98c6e740  InnoDB: Operating system error number 2 in a file operation.
InnoDB: The error means the system cannot find the path specified.
InnoDB: If you are installing InnoDB, remember that you must create
InnoDB: directories yourself, InnoDB does not create them.
InnoDB: Error: could not open single-table tablespace file ./myshop/mobile12.ibd
InnoDB: We do not continue the crash recovery, because the table may become
InnoDB: corrupt if we cannot apply the log records in the InnoDB log to it.
InnoDB: To fix the problem and start mysqld:
InnoDB: 1) If there is a permission problem in the file and mysqld cannot
InnoDB: open the file, you should modify the permissions.
InnoDB: 2) If the table is not needed, or you can restore it from a backup,
InnoDB: then you can remove the .ibd file, and InnoDB will do a normal
InnoDB: crash recovery and ignore that table.
InnoDB: 3) If the file system or the disk is broken, and you cannot remove
InnoDB: the .ibd file, you can set innodb_force_recovery > 0 in my.cnf
InnoDB: and force InnoDB to continue crash recovery here.
2016-01-23 20:31:07 2900 mysqld_safe mysqld from pid file /opt/lampp/var/mysql/DrBrm.pid ended

1 个答案:

答案 0 :(得分:1)

不幸的是,它看起来不是好消息。

根据您发布的错误日志,似乎mobile12数据库中的myshop表已损坏,这就是MySQL无法启动的原因。有三种建议的解决方案:

  

1)如果文件中存在权限问题且mysqld无法打开文件,则应修改权限。

检查MySQL数据目录中文件./myshop/mobile12.ibd的权限(可能是/opt/lampp/var/mysql)。将您找到的内容与数据目录中其他子目录中的其他文件进行比较。

  

2)如果不需要表,或者您可以从备份中恢复它,那么您可以删除.ibd文件,InnoDB将执行正常的崩溃恢复并忽略该表。

删除./myshop/mobile12.ibd文件。请注意,删除它会将其从数据库中销毁,因此您需要从备份中恢复。假设您有最近的备份,这很可能是最佳解决方案。

  

3)如果文件系统或磁盘损坏,并且您无法删除.ibd文件,则可以设置innodb_force_recovery&gt; my.cnf中的0并强制InnoDB在这里继续崩溃恢复。

我不清楚这里的评论是什么意思,如果这意味着设置innodb_force_recovery将尝试从损坏的文件中挽救数据,或者它是否会解决该文件并尝试自动删除它。

删除损坏的.idb文件后,守护程序应该再次正常启动。对不起消息感到抱歉,但这会让你再次前进。