“无法从mysql.procs_priv加载。该表可能已损坏”在Osx / homebrew上

时间:2017-04-30 04:53:41

标签: mysql corrupt

问题:

尝试创建新的mysql用户时获取Cannot load from mysql.procs_priv. The table is probably corrupted

平台:OSX Yosemite,Homebrew

已尝试其他答案的解决方案

  1. 升级:mysql_upgrade -uroot -p
    • 因此我不得不使用--forceThis installation of MySQL is already upgraded to 5.7.9, use --force if you still need to run mysql_upgrade
    • 接下来我必须使用--skip-version-check,因为:Error: Server version (5.7.18) does not match with the version of the server (5.7.9) with which this program was built/distributed. You can use --skip-version-check to skip this check.
    • 毕竟还没有工作
  2. 将查询简化为最明显且taking out functionsCREATE USER 'newuser';,仍会引发相同的错误。
  3. 修复mysql.procs_priv表
  4. char中的所有mysql.procs_priv列更改为varcharas suggested here。好吧,他建议改为text,但对于核心mysql表来说这似乎太疯狂了。

2 个答案:

答案 0 :(得分:2)

完全删除mysql并重新安装它(不到15分钟)。

<强> 1。卸载并从系统中清除MYSQL

  1. 备份数据库。
  2. 停止并终止任何MySQL进程。使用ps -ax | grep mysql
  3. 检查流程
  4. 卸载mysql

    brew remove mysql
    brew cleanup
    
  5. 删除所有残留文件

    sudo rm /usr/local/mysql
    sudo rm -rf /usr/local/var/mysql
    sudo rm -rf /usr/local/mysql*
    sudo rm ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
    sudo rm -rf /Library/StartupItems/MySQLCOM
    sudo rm -rf /Library/PreferencePanes/My*
    
  6. 卸载以前的自动登录

    launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist 
    
  7. 删除以前的配置。从MYSQLCOM=-YES-

  8. 删除行/etc/hostconfig
  9. 删除以前的偏好

    sudo rm -rf ~/Library/PreferencePanes/My*
    sudo rm -rf /Library/Receipts/mysql*
    sudo rm -rf /Library/Receipts/MySQL*
    sudo rm -rf /private/var/db/receipts/*mysql*
    sudo rm -rf /private/var/db/receipts/*mysql*
    sudo rm -rf /private/var/mysql
    
  10. 可选,重新启动计算机。我没有。

  11. <强> 2。安装MYSQL

    1. 安装Mysql

      brew install mysql
      
    2. 设置为在启动时运行

      brew services start mysql
      
    3. 保护安装

      mysql_secure_installation
      

答案 1 :(得分:2)

我认为最好使用它:

mysql_upgrade -u root -p

输入您的密码并等待几秒钟。