[ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2017-03-29 19:40
716 查看
环境: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] #basedir = /usr/local/Cellar/mysql/5.7.17 datadir = /usr/local/var/mysql #skip-external-locking # Instead of skip-networking the default is now to listen only on # localhost which is more compatible and is not less secure. bind-address = 127.0.0.1 port = 3306 # server_id = ..... [client] socket = /tmp/mysql.sock # Query Caching #query-cache-type = 1 #Default to InnoDB #default-storage-engine=innodb #sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
错误三:ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES)
$ mysql -uroot -p Enter password: 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 Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. 方案二: 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 ... 2017-03-29T10:04:00.213448Z 0 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/var/mysql/ is case insensitive 2017-03-29T10:04:00.215026Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2017-03-29T10:04:00.215044Z 0 [Note] InnoDB: Uses event mutexes 2017-03-29T10:04:00.215050Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier 2017-03-29T10:04:00.215055Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3 2017-03-29T10:04:00.215428Z 0 [Note] InnoDB: Number of pools: 1 2017-03-29T10:04:00.215582Z 0 [Note] InnoDB: Using CPU crc32 instructions 2017-03-29T10:04:00.217017Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M 2017-03-29T10:04:00.228108Z 0 [Note] InnoDB: Completed initialization of buffer pool 2017-03-29T10:04:00.243353Z 0 [Note] InnoDB: Highest supported file format is Barracuda. 2017-03-29T10:04:00.250459Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables 2017-03-29T10:04:00.250647Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ... 2017-03-29T10:04:00.311281Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB. 2017-03-29T10:04:00.312090Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active. 2017-03-29T10:04:00.312102Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active. 2017-03-29T10:04:00.312465Z 0 [Note] InnoDB: Waiting for purge to start 2017-03-29T10:04:00.365854Z 0 [Note] InnoDB: 5.7.17 started; log sequence number 2538666 2017-03-29T10:04:00.366081Z 0 [Note] InnoDB: Loading buffer pool(s) from /usr/local/var/mysql/ib_buffer_pool 2017-03-29T10:04:00.366203Z 0 [Note] Plugin 'FEDERATED' is disabled. 2017-03-29T10:04:00.368106Z 0 [Note] InnoDB: Buffer pool(s) load completed at 170329 18:04:00 2017-03-29T10:04:00.372234Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them. 2017-03-29T10:04:00.372252Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory. 2017-03-29T10:04:00.373055Z 0 [Warning] CA certificate ca.pem is self signed. 2017-03-29T10:04:00.373110Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory. 2017-03-29T10:04:00.373221Z 0 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306 2017-03-29T10:04:00.374246Z 0 [Note] - '127.0.0.1' resolves to '127.0.0.1'; 2017-03-29T10:04:00.374322Z 0 [Note] Server socket created on IP: '127.0.0.1'. 2017-03-29T10:04:00.456012Z 0 [Note] Executing 'SELECT * FROM INFORMATION_SCHEMA.TABLES;' to get a list of tables using the deprecated partition engine. You may use the startup option '--disable-partition-engine-check' to skip this check. 2017-03-29T10:04:00.456054Z 0 [Note] Beginning of list of non-natively partitioned tables 2017-03-29T10:04:00.469011Z 0 [Note] End of list of non-natively partitioned tables 2017-03-29T10:04:00.469229Z 0 [Note] mysqld: ready for connections. Version: '5.7.17' socket: '/tmp/mysql.sock' port: 3306 Homebre
错误四:Unknown column ‘password’ in ‘field list’
jddeiMac:tmp iosTest$ mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 Server version: 5.7.17 Homebrew Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> UPDATE mysql.user SET password=PASSWORD('root') WHERE user='root'; ERROR 1054 (42S22): Unknown column 'password' in 'field list'
解决方法:
新安装的MySQL5.7,登录时提示密码错误,安装的时候并没有更改密码,后来通过免密码登录的方式更改密码,输入update mysql.user set password=password('root') where user='root'时提示ERROR 1054 (42S22): Unknown column 'password' in 'field list',原来是mysql数据库下已经没有password这个字段了,password字段改成了 authentication_string 所以更改语句替换为update MySQL.user set authentication_string=password('root') where user='root' ;即可
错误五:ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)
iMac:~ iosTest$ mysql.server startStarting MySQL
错误六:ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> SET PASSWORD = PASSWORD('new password'); Query OK, 0 rows affected, 1 warning (0.11 sec) mysql> ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER; Query OK, 0 rows affected (0.02 sec) mysql> flush privileges; Query OK, 0 rows affected (0.03 sec) mysql> \q Bye jddeiMac:~ iosTest$ mysql -uroot -pxxxx mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 5 Server version: 5.7.17 Homebrew Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | logs | | mysql | | performance_schema | | sys | +--------------------+ 5 rows in set (0.10 sec)
参考资料链接:
Mac Pro下卸载安装Mysql
相关文章推荐
- mysql启动不了,报错“[ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it”
- Mysql :Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
- mysql运行时报错,“Can't open the mysql.plugin table”
- mysql运行时报错,“Can't open the mysql.plugin table”
- MySQL安装好后无法运行(Can't open the mysql.plugin table)
- 解决mysql启动错误:Fatal error: mysql.user table is damaged. Please run mysql_upgrade.
- Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist的解决方法
- ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'
- 安装mysql 出现:Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
- mysql 启动报错 /usr/local/mysql//libexec/mysqld: Can't create/write to file '/var/run/mysqld/mysqld.pid'
- Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
- MySQL Error Number 1005 Can’t create table ‘XX.frm’ (errno: 150)
- MySQL错误之ERROR 1005 (HY000): Can't create table '******' (errno: 150)
- MySQL error: Can’t open and lock privilege tables: table doesn’t exist
- MySQL Error Number 1005 Can’t create table ‘XX.frm’ (errno: 150)
- Mysql 的ERROR 1005 (HY000): Can't create table 'xxx' (errno: 150)
- 安装mysql的1067错误的可能原因:Fatal error: Can't open privilege tables: Table mysql.user doesn't exist
- Error “Unable to copy the file xxx from the project template to the project. Can't find the file \xxxx” when create VS template
- Mendeley word plugin安装问题:Uable to install the Microsoft Word Plugin.Please run word at least once...
- SYBASE备份报错:Can't open a connection to site 'SYB_BACKUP',see the error log file in the ASE directory