• 升级MySQL 5.7版本遇到的一些小问题(转)


    在5.6版本服务器做备份

    /usr/local/mysql/bin/mysqldump -S /tmp/mysql3306.sock -A -p --set-gtid-purged=OFF > backup_20160204.sql

    在5.7版本服务器操作

    mkdir -p /neworiental/data/mysql/mysql3307/{data,logs,relaylog,sock,tmp}

    chown -R mysql:mysql /neworiental/data

    初始化数据库
    /usr/local/mysql/bin/mysqld --defaults-file=/neworiental/data/mysql/mysql3307/my3307.cnf  --initialize-insecure

    恢复数据库(全量数据)
    /usr/local/mysql/bin/mysql -S /neworiental/data/mysql/mysql3307/sock/mysql3307.sock -p  <    backup_20160204.sql

    查看所有用户没有密码!!!

    select user,host,authentication_string,plugin from mysql.user;

    修改密码

    UPDATE mysql.user SET authentication_string=PASSWORD(‘password‘) WHERE User=‘root‘ and host=‘localhost‘;
    FLUSH PRIVILEGES;
    验证登入,登出,正常
    重启之后,还是正常

    只有日志有报错
    2016-02-04T08:26:56.700344Z 0 [ERROR] Incorrect definition of table mysql.db: expected column ‘User‘ at position 2 to have type char(32), found type char(16).
    2016-02-04T08:26:56.700391Z 0 [ERROR] mysql.user has no `Event_priv` column at position 28
    2016-02-04T08:26:56.700574Z 0 [ERROR] Event Scheduler: An error occurred when initializing system tables. Disabling the Event Scheduler.

    进行数据库升级
    /usr/local/mysql/bin/mysqld_safe --defaults-file=/neworiental/data/mysql/mysql3307/my3307.cnf --skip-grant-tables &
    /usr/local/mysql/bin/mysql_upgrade --defaults-file=/neworiental/data/mysql/mysql3307/my3307.cnf -p --force
    重启之后,日志正常了

    问题语句:(5.7.10)
    GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘localhost‘ IDENTIFIED BY  ‘password‘   WITH GRANT OPTION;

    技术分享

    系统表字段已乱

    技术分享

    日志中记录 noboby can currently load!!!

    技术分享

    无法登陆

    技术分享

    无法停止

    以下是解决办法:

    技术分享


    解决办法:
    UPDATE mysql.user SET authentication_string=PASSWORD(‘password‘) WHERE User=‘root‘ and host=‘localhost‘;
    UPDATE mysql.user SET plugin=‘mysql_native_password‘  WHERE User=‘root‘ and host=‘localhost‘;
    FLUSH PRIVILEGES;
    1.已验证,此语句在5.6.28版本运行正常。(因为是源库,因为是一个版本,因为没有发生迁移)
    2.无论是覆盖,还是新建,都不行  (版本问题,后面会说)

    之前还残留两个5.7问题
    1.恢复之后的数据库,mysql.user所有用户没有密码!!! (见结论)
    2.使用全库恢复,会把‘mysql.sys‘@‘localhost‘覆盖,不知是否有影响?->必须有影响! (见结论)


    结论&解决办法已验证
    因为数据库版本问题,全库恢复之后,系统表会被覆盖,(变相的给降级了!!!)所以夸版本的情况,全库dump,恢复之后,必须做版本update,然后重启数据库!!!

  • 相关阅读:
    李超线段树 (Li-Chao Segment Tree)
    NowCoder Contest 894
    AtCoder Beginning Contest 126
    华工软院IBM LinuxONE Community Cloud云计算实验文档
    Codeforces Round #561 (div. 2)
    Comet OJ Contest #3
    Codeforces Edu Round 65 (Rated for Div. 2)
    莫队算法 (Mo's Algorithm)
    Codeforces Round #559 (Div. 2)
    GDCPC2019 广东省赛总结
  • 原文地址:https://www.cnblogs.com/moss_tan_jun/p/5668486.html
Copyright © 2020-2023  润新知