mysql5.7 修改root密码
2015-12-01 11:19
495 查看
1.编辑MySQL配置文件(忽略授权表) #编辑文件,找到[mysqld],在下面添加一行skip-grant-tables
vi /etc/my.cnf
[mysqld]
skip-grant-tables
:wq! #保存退出
2.重启服务
#service mysql restart
(-my_print_defaults: [Warning] World-writable config file '/etc/my.cnf' is ignored.
Starting MySQL
-chmod 644 /etc/my.cnf)
3.进入mysql,因为之前已经跳过输入密码登陆,直接回车就可以进入
#mysql -uroot -p
4.修改密码,这里跟之前的改密码的字段不一样,
>update mysql.user set authentication_string=password(‘newpass‘) where user=‘root‘;
>flush privileges
>quit
5.将/etc/my.cnf文件 skip-grant-tables注释掉,重启服务
#service mysql resart
6.使用 mysql -uroot -p 输入密码 就可以进了
vi /etc/my.cnf
[mysqld]
skip-grant-tables
:wq! #保存退出
2.重启服务
#service mysql restart
(-my_print_defaults: [Warning] World-writable config file '/etc/my.cnf' is ignored.
Starting MySQL
-chmod 644 /etc/my.cnf)
3.进入mysql,因为之前已经跳过输入密码登陆,直接回车就可以进入
#mysql -uroot -p
4.修改密码,这里跟之前的改密码的字段不一样,
>update mysql.user set authentication_string=password(‘newpass‘) where user=‘root‘;
>flush privileges
>quit
5.将/etc/my.cnf文件 skip-grant-tables注释掉,重启服务
#service mysql resart
6.使用 mysql -uroot -p 输入密码 就可以进了
相关文章推荐
- MySql实现动态分页
- Mysql字符串位置函数locate,可检测是否包含字符串
- ubuntu下mysql 开启远程连接
- ubuntu14.04 mysql-workbench Connecting to MySQL server ... Native table 'performance_schema'.'session_variables' has the wrong structure错误解决
- [Windows Server 2012] 手工破解MySQL密码
- Mysql文件太大导入失败解决办法总结
- mysql交互式连接&非交互式连接
- MySQL中隐式转换
- MySQL5.6 mysqldump 数据库备份的正确操作
- MySQL的备份工具mysqldump的基础使用命令总结
- 初学JSP与JDBC(mysql数据库)
- Mysql 相关 记录
- Mysql导入导出大量数据的方法、备份恢复办法
- Mysql导入导出大量数据的方法、备份恢复办法
- MySQL查询执行的基础
- MySQL的备份工具mysqldump的基础使用命令总结
- 日常收集整理常见的mysql sql技巧
- MySQL Jdbc驱动的rewriteBatchedStatements参数
- mysql中的多行查询结果合并成一个
- mysql 增加另一台主从的步骤方法