• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • MsSql
  • Mysql
  • oracle
  • MariaDB
  • DB2
  • SQLite
  • PostgreSQL
  • MongoDB
  • Redis
  • Access
  • 数据库其它
  • sybase
  • HBase
您的位置:首页 > 数据库 >Mysql > mysql重置密码

mysql重置密码

作者:匿名 字体:[增加 减小] 来源:互联网 时间:2018-12-05

匿名通过本文主要向大家介绍了mysql等相关知识,希望本文的分享对您有所帮助
mysql重置密码

wulilideMacBook-Pro:bin wulili$ mysql start

ERROR 1045 (28000): Access denied for user 'wulili'@'localhost' (using password: NO)

wulilideMacBook-Pro:bin wulili$ su - root

1、吧mysql服务关闭

2、

启动mysqld_safe ,跳过启动授权表。启动时加上skip-grant-tables参数目的是在启动mysql时不启动grant-tables,授权表。这样就可以修改root的密码了。

# mysqld_safe --skip-grant-tables &


wulilideMacBook-Pro:support-files root# find / -name mysqld_safe

find: /dev/fd/3: Not a directory

find: /dev/fd/4: Not a directory

/usr/local/mysql-5.7.16-osx10.11-x86_64/bin/mysqld_safe

wulilideMacBook-Pro:support-files root# /usr/local/mysql-5.7.16-osx10.11-x86_64/bin/mysqld_safe --skip-grant-tables &

[1] 1397

wulilideMacBook-Pro:support-files root# 2016-11-30T11:47:40.6NZ mysqld_safe Logging to '/usr/local/mysql/data/wulilideMacBook-Pro.local.err'.

2016-11-30T11:47:40.6NZ mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data

mysql -uroot -p

Enter password: 按下回车键

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 2

Server version: 5.7.16 MySQL Community Server (GPL)


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 user set password=PASSWORD('12345678') where user="root";

ERROR 1046 (3D000): No database selected

mysql> use mysql;

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A


Database changed

mysql> update user set password=PASSWORD('12345678') where user="root";

ERROR 1054 (42S22): Unknown column 'password' in 'field list'

mysql> update user set passwd=PASSWORD('12345678') where user="root";

ERROR 1054 (42S22): Unknown column 'passwd' in 'field list'

mysql> update user set password=password('12345678') where User='root';

ERROR 1054 (42S22): Unknown column 'password' in 'field list'

mysql> update user set authentication_string=password('12345678') where user="root";

Query OK, 1 row affected, 1 warning (0.01 sec)

Rows matched: 1 Changed: 1 Warnings: 1


mysql> flush privileges;

Query OK, 0 rows affected (0.00 sec)


mysql> quit

Bye

3、重启数据库


wulilideMacBook-Pro:support-files root# /usr/local/mysql/support-files/mysql.server restart

Shutting down MySQL

..2016-11-30T11:58:22.6NZ mysqld_safe mysqld from pid file /usr/local/mysql/data/wulilideMacBook-Pro.local.pid ended

SUCCESS!

Starting MySQL

. SUCCESS!

[1]+ Done /usr/local/mysql-5.7.16-osx10.11-x86_64/bin/mysqld_safe --skip-grant-tables

wulilideMacBook-Pro:support-files root# mysql -u root -p 这里密码就是12345678了

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 4

Server version: 5.7.16


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> quit

Bye

wulilideMacBook-Pro:support-files root#




mysql> use mysql;

ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

mysql> alter user 'root'@'localhost' identified by '12345678';

Query OK, 0 rows affected (0.01 sec)


mysql> flush privileges;

Query OK, 0 rows affected (0.00 sec)


mysql> show databases;

+--------------------+

| Database |

+--------------------+

| information_schema |

| mysql |

| performance_schema |

| sys |

+--------------------+

4 rows in set (0.00 sec)

分享到:QQ空间新浪微博腾讯微博微信百度贴吧QQ好友复制网址打印

您可能想查找下面的文章:

相关文章

  • 2017-05-11MySQL触发器学习总结
  • 2018-12-05将Reporting services的RDL文件拷贝到另外一台机器时报Data at t
  • 2017-05-11MySQL数据库防止人为误操作的实例讲解
  • 2018-12-05MySQL 数据库常用命令(使用)
  • 2018-12-05MySQl数据库必知必会的加强版sql语句
  • 2018-12-05mysql启动提示mysql.host 不存在,启动失败的解决方法
  • 2018-12-05SQL Server 版本变更检查 警告
  • 2017-05-11MySQL编程中的6个实用技巧
  • 2018-12-05PL/SQL实现Oracle数据库任务调度
  • 2018-12-05sql 查询本年、本月、本日记录的语句,附SQL日期函数

文章分类

  • MsSql
  • Mysql
  • oracle
  • MariaDB
  • DB2
  • SQLite
  • PostgreSQL
  • MongoDB
  • Redis
  • Access
  • 数据库其它
  • sybase
  • HBase

最近更新的内容

    • ORACLE 自动提交问题
    • oracle 分页问题解决方案
    • sql 游标使用笔记
    • 对SQL查询方法精彩汇总
    • 访问和更改关系数据,使用MSSQL外联接
    • MySQL索引背后的之使用策略及优化(高性能索引策略)
    • mysql中order by in 的字符顺序(推荐)
    • 推荐MySQL常用函数+福利
    • 在Docker中使用MySQL的教程
    • MySQL5.7.18在Windows如何下安装的教程

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有