mysql学习之-密码管理(默认密码,修改密码,解决忘记密码)
1. mysql安装后默认没有密码,初始化安装后默认密码登录,需要马上修改root密码。
[root@mysql ~]# cat /root/.mysql_secret --查看root账号密码
# The random password set for the root user at Tue Dec 13 18:59:06 2016 (local time): 7MhtyX3aZEl9OUf8
[root@mysql ~]# mysql -uroot -p -- 登录mysql
Enter password: --(此处复制粘贴 7MhtyX3aZEl9OUf8)
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.25
Copyright (c) 2000, 2015, 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> 表示一切顺利成功。
2. 修改密码
mysql> SET PASSWORD = PASSWORD('123456'); --设置密码为123456
[root@mysql etc]# mysql -uroot -p123456 --修改密码后,登录
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 39
Server version: 5.6.25 MySQL Community Server (GPL)
mysql> --登录成功
3. 忘记mysql数据库root的密码后,如何修改密码。
[root@mysql etc]# service mysql stop --停止mysql进程
Shutting down MySQL.... SUCCESS!
[root@mysql etc]# mysqld_safe --skip-grant-tables& --启动mysql时不启动grant-tables,授权表。执行后出现下面画面,另起一个新会话。
[1] 3574
[root@mysql etc]# 161215 06:13:53 mysqld_safe Logging to '/var/lib/mysql/mysql.err'.
161215 06:13:53 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
[root@mysql ~]# ps -ef|grep mysql --查看mysql进程是否起来
root 3467 3440 0 05:29 pts/2 00:00:00 mysql -uandy -px xx
root 3574 2845 0 06:13 pts/0 00:00:00 /bin/sh /usr/bin/mysqld_safe --skip-grant-tables
mysql 3677 3574 2 06:13 pts/0 00:00:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-
mysql> UPDATE user SET password=PASSWORD('cccccc') WHERE user='root'; --更改root密码
Query OK, 4 rows affected (0.04 sec)
Rows matched: 4 Changed: 4 Warnings: 0
mysql> FLUSH PRIVILEGES; --权限更新
Query OK, 0 rows affected (0.00 sec)
[root@mysql ~]# mysql -uroot -p123456 --使用旧密码登录,发现不行,说明密码已经更新
Warning: Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[root@mysql ~]# mysql -uroot -pcccccc --新密码登录成功
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
mysql>
mysql学习之-密码管理(默认密码,修改密码,解决忘记密码)的更多相关文章
- CenctOS6 and CenctOS7 多种姿势解决忘记密码
-----linux---- 忘记密码啦!!! 忘记密码教程!!! 教你们忘记密码(我原来密码就是123456,忘记是不可能的!假装忘记的样子 0.0) 现在我们忘记密码了!对忘记密码了.我忘记密码了 ...
- mysql学习之权限管理
数据库权限的意义: 为了保证数据库中的业务数据不被非授权的用户非法窃取,需要对数据库的访问者进行各种限制,而数据库安全性控制措施主要有这三种,第一种用户身份鉴别,手段可以是口令,磁卡,指纹等技术,只有 ...
- MySQL解决忘记密码问题
解决Win10下Mysql 的Access denied for user'root'@'localhost' (using password: NO)问题 mysql一旦忘记密码即会出现这样的错误. ...
- day55-mysql-用户权限、修改秘密、忘记密码
.用户权限:新创建的用户没有库,如果想让新用户访问我的库,必须给它授权才可以.我在使用的navicat要关闭新用户的连接才可以授权给它. .创建用户 '; -- 创建用户 .移除用户 drop use ...
- [git 学习篇]git管理的是修改,并非文件
你会问,什么是修改?比如你新增了一行,这就是一个修改,删除了一行,也是一个修改,更改了某些字符,也是一个修改,删了一些又加了一些,也是一个修改,甚至创建一个新文件,也算一个修改. 为什么说Git管理的 ...
- MySQL学习之用户管理
用户权限管理 用户权限管理:在不同的项目中给不同的角色(开发者)不同的操作权限,为了保证数据库数据的安全. 简单点说:有的用户可以访问并修改这个数据,而有些用户只能去查看数据,而不能修改数据.就如同博 ...
- mysql 解决忘记密码 mysql5.7 远程登录不上MySQL(解决腾讯服务器初始mysql密码问题)
一.修改MySQL启动配置文件 #如果不知道配置文件,先查找find / -name my.cnf#编辑配置文件 vim /etc/my.cnf 在[mysql] 下面第一行加入 skip-gran ...
- mysql学习------二进制日志管理
MySQL二进制日志(Binary Log) a.它包含的内容及作用如下: 包含了所有更新了数据或者已经潜在更新了数据(比如没有匹配任何行的一个DELETE) 包含关于每个更新数据库( ...
- JavaScript学习笔记-商品管理新增/删除/修改功能
<!DOCTYPE html> <html lang="en" xmlns="http://www.w3.org/1999/xhtml"> ...
随机推荐
- AlarmManager
转自:http://blog.csdn.net/wangxingwu_314/article/details/8060312 1.AlarmManager,顾名思义,就是“提醒”,是Android中常 ...
- nslayoutConstraint
1.vfl的正确编写格式 NSDictionary *dict1 = NSDictionaryOfVariableBindings(_boxV,_headerL,_imageV,_backBtn,_d ...
- 转 如何用mt7620方案的rt2860v2驱动实现wifi探针功能,网上能搜到一些方法,但是讲的好模糊?
原文:http://www.zhihu.com/question/33559283 如何用mt7620方案的rt2860v2驱动实现wifi探针功能,网上能搜到一些方法,但是讲的好模糊? 如何用mt7 ...
- 【FreeBuf视频】《安全大咖说》专访知道创宇CTO杨冀龙(watercloud)
[FreeBuf视频]<安全大咖说>专访知道创宇CTO杨冀龙(watercloud) 发布于 2016/05/16 FreeBuF.COM 杨冀龙,江湖人称watercloud,知道创宇公 ...
- Osmocom-BB MOTO C118硬刷
写在最前面,先知我YY下硬刷最好可能实现的功能: 1.把软件刷入flash,修改loader后,可以实现上电就自动运行程序: 2.硬刷后,程序自动起来,可以修改loader就行加密 3.硬刷后,有可能 ...
- 关于binary search的一点解惑
在写binary search时对于mid的计算我最开始使用的是 mid = (low + high)/2; 后来看到在很多的实现为 mid = low + (high - low)/2; 想了一下两 ...
- Construct a basic automation test framework
Elements in an automation test framework: actor,---simulate trader, have its own name, can get contr ...
- 【Oracle XE系列之二】PLSQL Developer 远程连接Oracle XE数据库
1.去http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html下载Instant Cli ...
- HDU 4396
http://acm.hdu.edu.cn/showproblem.php?pid=4396 题意:在至少走k条边的前提下求最短路 思路:在原有最短路模板的基础上多加一维,dis[i][j]表示走到i ...
- C# 入门篇之listview用法
在用listview,经常对各种属性都不了解,用完了,下次又忘:写个随笔记记. 看到别人已经有总结很详细的,就直接转过来了,可能中间会有一些自己加的. ------------------------ ...