zoukankan      html  css  js  c++  java
  • Mysql 用户root密码重置

    Asterisk安装完成之后,接手新的Asterisk系统后不清楚Mysql的root账号密码。

    重新重置mysql的root密码的方式

    先查看mysql的版本号。

    我的测试环境下的mysql版本为5.1.73版本

    mysql  Ver 14.14 Distrib 5.1.73, for redhat-linux-gnu (x86_64) using readline 5.1

    1.#编辑mysql配置文件:

    vim /etc/my.cnf  或者/etc/my.ini 在修改之前最好做下备份

    #添加 在文件的[mysqld]节点进行添加一行,

    skip-grant-tables

    2.然后在CentOS6.x系统下 通过脚本重新启动Mysql服务

    /etc/init.d/mysqld restart

    Stopping mysqld: [ OK ]
    Starting mysqld: [ OK ]

    登录Mysql

    再登录Mysql就没有密码了,登入mysql后,show databases;

    mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY ' 这里填写新的root密码 ' WITH GRANT OPTION;

    mysql>FLUSH PRIVILEGES;

    搞定,然后,重新将my.cnf 中的#skip-grant-tables  注释掉

    然后再重启mysql服务。

    /etc/init.d/mysqld restart

    在mysql中进行更改password并对相对应的库进行授权

    mysql> UPDATE mysql.user SET Password=PASSWORD('root@123') where USER='root';
    Query OK, 0 rows affected (0.00 sec)
    Rows matched: 4 Changed: 0 Warnings: 0

    mysql> flush privileges;
    Query OK, 0 rows affected (0.00 sec)

    然后再重新启动mysql服务即可。

    或者采用另外一种方式进行更改mysql root账户密码;

    use mysql; 选择mysql库

    update user set password=password('这里是密码') where user='root';

    至此密码已经更改完成,

  • 相关阅读:
    6. Flask请求和响应
    5. Flask模板
    FW:Software Testing
    What is the difference between modified duration, effective duration and duration?
    How to push master to QA branch in GIT
    FTPS Firewall
    Query performance optimization of Vertica
    (Forward)5 Public Speaking Tips That'll Prepare You for Any Interview
    (转)The remote certificate is invalid according to the validation procedure
    Change
  • 原文地址:https://www.cnblogs.com/Enzoo/p/11151799.html
Copyright © 2011-2022 走看看