zoukankan      html  css  js  c++  java
  • phpstudy 升级(更换) mysql 版本

    原文链接:http://phpstudy.php.cn/jishu-php-3131.html

    一、下载新版 mysql

    例如 mysql5.7: https://dev.mysql.com/downloads/file/?id=467269

    二、备份 phpStudyPHPTutorialMySQL

    三、解压下载的新版 mysql,放于 phpStudyPHPTutorial 中,重命名为 MySQL

    四、复制一份 my-default.ini,重命名为 my.ini

    五、修改my.ini配置

    basedir = D:/phpStudy/PHPTutorial/MySQL
    datadir = D:/phpStudy/PHPTutorial/MySQL/data
    skip-grant-tables

    注:根据自己的实际路径情况改,有配置的改,没有的可以自己加,加在 [mysqld] 下就行

    六、在 cmd 下进入 MySQL 的 bin 目录(我的是 D:/phpStudy/PHPTutorial/MySQL/bin),执行初始化命令

    mysqld --initialize

    注1:如果报 TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 错误,则修改 my.ini 配置,在 [mysqld] 下添加

    explicit_defaults_for_timestamp = true

    注2:如果报 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release. 错误,则修改 my.ini ,在 [mysqld] 下添加(已有配置的直接修改)

    sql_mode = NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES,NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER

    七、安装并启动服务

    mysqld -install
    net start MySQL

    八、修改 mysql 登录密码

    mysql -uroot -p

    PS:不用输密码,直接回车就行

    update mysql.user set authentication_string=password('root') where user='root' and Host ='localhost';

    注:'root'只是一个示例,自行修改成自己想要的密码

    刷新权限

    FLUSH PRIVILEGES;

    九、修改 my.ini,注释掉 skip-grant-tables

    # skip-grant-tables

    重启 mysql

    net stop MySQL
    net start MySQL


    PS:这样修改完后,直接 phpstudy 启动 mysql 可能会失败,暂时还没找到原因,暂时的解决办法的,用 phpstudy 启动 apache(或 nginx),然后 cmd 使用 net start MySQL 来启动 mysql

  • 相关阅读:
    linux 短信收发
    sama5d3 环境检测 adc测试
    【Codeforces 723C】Polycarp at the Radio 贪心
    【Codeforces 723B】Text Document Analysis 模拟
    【USACO 2.2】Preface Numbering (找规律)
    【Codeforces 722C】Destroying Array (数据结构、set)
    【USACO 2.1】Hamming Codes
    【USACO 2.1】Healthy Holsteins
    【USACO 2.1】Sorting A Three-Valued Sequence
    【USACO 2.1】Ordered Fractions
  • 原文地址:https://www.cnblogs.com/tujia/p/10734879.html
Copyright © 2011-2022 走看看