MySQL 错误 2006 MySQL 服务器在 Max OS X 10.8.3 上使用自制软件升级到 5.6.10 后消失了

Ali*_*mii 5 mysql phpmyadmin mac-os-x errors

我使用自制软件在 Mac OS X 10.8.3 上升级了 MySQL 的安装

brew install mysql

一切似乎都很顺利,但……事实并非如此。

我无法添加新用户(既不能通过命令行也不能通过 phpmyadmin。我总是收到错误消息

Error in processing request: #2006 MySQL server has gone away

我可以毫无问题地创建新数据库,并且可以毫无问题地安装,例如 Joomla 3.1.1。

但是,当我尝试在 Joomla 安装中安装新扩展时,出现错误。例如,当我尝试从 NoNumber 安装组件时出现以下错误:

1062 Duplicate entry '1' for key 'PRIMARY' SQL=INSERT INTO `u5z87_extensions` (`name`,`type`,`element`,`folder`,`client_id`,`enabled`,`access`) VALUES ('plg_system_nnframework','plugin','nnframework','system','0','1','1')
Run Code Online (Sandbox Code Playgroud)

许多其他扩展也是如此。

我试图用

mysql.server start --log-warnings=2

它开始没有问题

Starting MySQL
 SUCCESS!
Run Code Online (Sandbox Code Playgroud)

我查看了报告错误 #2006 的问题以及如何解决它们,他们提到修改 /etc/my.cnf 但我的系统上没有 /etc/my.cnf 配置文件,而且没有在之前安装的 MySQL 5.5.29(也安装了自制软件)中,我没有任何问题。

我跑brew doctor了,输出如下

$ brew doctor
Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and what additional flags to use when
compiling and linking.

Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew provided
script of the same name. We found the following "config" scripts:

    /usr/local/opt/php54/bin/php-config
Run Code Online (Sandbox Code Playgroud)

的输出brew --config也如下:

$ brew --config
HOMEBREW_VERSION: 0.9.4
ORIGIN: https://github.com/mxcl/homebrew
HEAD: 86ce842c700a47abdc354e80cc3b0b3938ab2132
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: 8-core 64-bit nehalem
OS X: 10.8.3-x86_64
Xcode: 4.6.2
CLT: 4.6.0.0.1.1365549073
LLVM-GCC: build 2336
Clang: 4.2 build 425
X11: 2.7.4 => /opt/X11
System Ruby: 1.8.7-358
Perl: /usr/bin/perl
Python: /usr/bin/python
Ruby: /Users/alisamii/.rvm/rubies/ruby-1.9.3-p374/bin/ruby
Run Code Online (Sandbox Code Playgroud)

进一步探索,我尝试使用以下方法恢复到我以前安装的 MySQL

brew switch mysql 5.5.29

这导致了以下输出:

$ brew switch mysql 5.5.29
Cleaning /usr/local/Cellar/mysql/5.5.29
Cleaning /usr/local/Cellar/mysql/5.6.10
135 links created for /usr/local/Cellar/mysql/5.5.29
Run Code Online (Sandbox Code Playgroud)

然后我从命令行访问 mysql 并运行状态:

mysql> status
--------------
mysql  Ver 14.14 Distrib 5.5.29, for osx10.8 (i386) using readline 5.1

Connection id:      13
Current database:
Current user:       alisamii@localhost
SSL:            Not in use
Current pager:      stdout
Using outfile:      ''
Using delimiter:        ;
Server version:     5.6.10 Source distribution
Protocol version:       10
Connection:         Localhost via UNIX socket
Server characterset:    utf8
Db     characterset:    utf8
Client characterset:    utf8
Conn.  characterset:    utf8
UNIX socket:        /tmp/mysql.sock
Uptime:         1 hour 56 min 24 sec
Run Code Online (Sandbox Code Playgroud)

正如你在上面看到的,它报告 mysql Ver 14.14 Distrib 5.5.29, for osx10.8 (i386) using readline 5.1

但是,它还说 Server version: 5.6.10 Source distribution

所以有些东西没有同步。

此外,当我显示数据库时,我得到以下输出:

mysql> show databases
    -> ;
+--------------------+
| Database           |
+--------------------+
| information_schema |
+--------------------+
1 row in set (0.00 sec)
Run Code Online (Sandbox Code Playgroud)

但我知道我拥有的不仅仅是一个information_schema数据库。在 phpMyAdmin 中,我显示了 14 个数据库。

所以,在某种程度上,这在我看来,MySQL是没有连接到正确的服务器,phpMyAdmin的报告在同一台服务器信息MySQL的status命令报告:Software version: 5.6.10 - Source distribution

在这一点上,我完全迷失了,真的需要一些帮助。

Ali*_*mii 2

好的,部分解决了问题。

根据https://dba.stackexchange.com/users/993/ypercube的推荐,我阅读了与mysql_update相关的页面并遵循了那里的建议。

升级 MySQL 不会升级 information_schema,因此有些功能不起作用。此命令有助于解决其中一些问题。

现在,我可以添加新用户,并且 #2006 - MySQL 服务器已消失错误不再是问题。

但是,例如,当尝试在 Joomla 中安装扩展时,我仍然收到 #1062 错误。仍在探索解决方案。解决后将更新此答案并提供详细信息。