3

我使用自制软件升级了我在 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')

许多其他扩展也是如此。

我试图用

mysql.server start --log-warnings=2

它开始没有问题

Starting MySQL
 SUCCESS!

我查找了报告错误#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

的输出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

进一步探索,我试图恢复到我以前安装的 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

然后我从命令行访问 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

如您在上面看到的,它报告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)

但我知道我拥有的不仅仅是一个information_schema数据库。

来自 phpmyadmin 的屏幕截图

所以,不知何故,在我看来,mysql 没有连接到正确的服务器,因为 phpmyadmin 报告的服务器信息与 mysql 的 status 命令报告的服务器信息相同:Software version: 5.6.10 - Source distribution.

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

4

1 回答 1

0

好的,所以部分解决了这个问题。

https://stackoverflow.com/users/201789/tehshrike的建议下,我阅读了与mysql_update相关的页面并遵循了那里的建议。

升级 MySQL 不会升级 information_schema,所以有些东西不起作用。此命令有助于解决其中一些问题。

现在,我可以添加新用户,并且 #2006 - MySQL server has gone away 错误不再是问题。

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

于 2013-05-27T19:42:33.377 回答