• mysql密码相关


    Q1: root密码登录不了或忘记root密码

    Answer: 在mysql配置文件(my.cnf / base.cnf)中[mysqld]下添加一行 skip_grant_tables,然后重启mysql,root用户即可无密码登录,然后设置新密码(详见Q2/Q3),再删除skip_grant_tables并重启mysql。

    ***********************************************************************
    ## v1.0 root@karl-v1:/srv/leyao/main# cat conf.d/base.cnf [mysqld] init_connect='SET collation_connection = utf8_unicode_ci' init_connect='SET NAMES utf8' character-set-server=utf8 collation-server=utf8_unicode_ci query_cache_size = 64M query_cache_type = 1 join_buffer_size = 512K max_connections = 150 max_allowed_packet = 32M skip_grant_tables root@karl-v1:/srv/leyao/main#
    ************************************************************************* # v2.
    0 karl-v2 docker # cat mysql/my.cnf # The MySQL Client configuration file. # # For explanations see # http://dev.mysql.com/doc/mysql/en/server-system-variables.html [mysql] [mysqld] sql-mode="STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" character-set-server=utf8 max_allowed_packet=1048576 skip_grant_tables karl-v2 docker #

    Q2: 设置/修改root密码(v1.0)

    use mysql;
    update user set password=password("new_pwd") where user='root';
    flush privileges;
    update user set authentication_string=password('t4ecK@^y7I4CGJnwtajWuKDmAwktngth') where user='root'; #new try

    Q3: 设置/修改root密码(v2.0)

    use mysql;
    alter user 'root'@'%' identified by 'new_pwd';
    flush privileges;
  • 相关阅读:
    tp3.2和Bootstrap模态框导入excel表格数据
    PHPEXCEL导入导出
    Yar请求数据接口
    php函数
    Linux常用操作命令
    PHP读取excel表格,和导出表格
    PHP 查找二维数组中是否有指定字符串的字段
    下载百度网盘大文件
    thinkPHP写txt日志文件
    PHP接收post请求,不是空数组就是没值,怎么办!
  • 原文地址:https://www.cnblogs.com/karl-python/p/10867686.html
Copyright © 2020-2023  润新知