[ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it

跳转链接
远程连接MySQL:
mysql -u 用户名 -h 远程IP地址 -p
brew intall
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
iMac系统环境:mysql(5.7.17) install for mac(10.11.13)
环境设置及启动数据库:
brew install mysql echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile source ~/.profile 检查一下mysql的运行状态 $ ps -ef | grep mysql 检查mysql 版本号; mysql --version 查看 mysqld服务启动时候,配置文件的读取顺序: mysqld --verbose --help | grep -A 1 'Default options' 启动mysql: $mysql.server start

Mac 关于Mysql的卸载:
如使用brew安装:brew uninstall MySQL 或者 brew remove mysql
但是又有点怕某些东西没有卸载完全影响到下一次的安装(我第一次重装就是这样的)以下是完整一点的手动卸载:
sudo rm /usr/local/mysql sudo rm -rf /usr/local/mysql* sudo rm -rf /Library/StartupItems/MySQLCOM sudo rm -rf /Library/PreferencePanes/My* rm -rf ~/Library/PreferencePanes/My* sudo rm -rf /Library/Receipts/mysql* sudo rm -rf /Library/Receipts/MySQL* sudo rm -rf /var/db/receipts/com.mysql.* 其实不同的安装方式有些东西的存储位置不一样,删除完检查一下一些问文件是否删除了,没有的话则删除掉: /usr/local/Cellar 里的mysql文件 /usr/local/var 里的mysql文件 /tmp 里的mysql.sock, mysql.sock.lock, my.cnf文件 pid文件和err文件都在/usr/local/var/mysql里确保删除了 brew安装的安装包存储在/usr/local/Library/Cache/Homebrew也可以一并删除 执行brew cleanup
错误一:Error: The brew link step did not complete successfully
在brew执行install mysql之后会出现一系列的安装信息,出现一个Error,查看到了ERROR的内容:
Error: The brew link step did not complete successfully The formula built, but is not symlinked into /usr/local Could not symlink lib/libmysqlclient.20.dylib /usr/local/lib is not writable. You can try again using: brew link mysql
~ brew link mysql
Linking /usr/local/Cellar/mysql/5.7.12...
Error: Could not symlink lib/libmysqlclient.20.dylib
/usr/local/lib is not writable. //这个文件夹不可写
sudo chown -R $(whoami) /usr/local/lib/ Password: ➜ ~ brew link mysql Linking /usr/local/Cellar/mysql/5.7.12… 93 symlinks created
错误二:Can\’t open the mysql.plugin table.
ERROR! The server quit without updating PID file (/usr/local/var/mysql/xxxiMac.local.pid). mysqld: Table 'mysql.plugin' doesn't exist [ERROR] Can\'t open the mysql.plugin table. Please run mysql_upgrade to create it. 解决方法: unset TMPDIR mysql_install_db --verbose --user=mysql --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql
/etc/my.cnf 配置文件信息
[mysqld_safe] log-error = /usr/local/var/mysql/logs/error.log [mysqld] datadir = /usr/local/var/mysql bind-address = 127.0.0.1 port = 3306 [client] socket = /tmp/mysql.sock
错误三:ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES)
方案一: jddeiMac:~ iosTest$ mysql.server stop Shutting down MySQL .. SUCCESS! jddeiMac:~ iosTest$ mysql.server start --skip-grant-tables Starting MySQL . SUCCESS! jddeiMac:~ iosTest$ mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 Server version: 5.7.17 Homebrew 方案二: jddeiMac:tmp iosTest$ mysqld --skip-grant-tables & [1] 18745 jddeiMac:tmp iosTest$ 2017-03-29T10:04:00.209544Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2017-03-29T10:04:00.209815Z 0 [Note] --secure-file-priv is set to NULL. Operations related to importing and exporting data are disabled 2017-03-29T10:04:00.209889Z 0 [Note] mysqld (mysqld 5.7.17) starting as process 18745 ...

你可能感兴趣的:([ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it)