linux(centos6.5)系统中忘记mysql root的密码的解决方法
2016-01-21 20:21
731 查看
1)首先编辑mysql的主配置文件 vim /etc/my.cnf
2)在[mysqld]字段下加入skip-grant
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 8(放在这条语句后面,)
skip-grant
3)重启mysql服务。/etc/init.d/mysqld restart
4)登入mysql ,直接回车进入mysql /usr/local/mysql/bin/mysql -uroot -p
5)更改密码;
mysql> use mysql;
mysql>update mysql.user SET password=PASSWORD("新密码") where user='root';
6)最后删除掉skip-grant,在重启mysql服务就可用新密码登录。
2)在[mysqld]字段下加入skip-grant
# Try number of CPU's*2 for thread_concurrency
thread_concurrency = 8(放在这条语句后面,)
skip-grant
3)重启mysql服务。/etc/init.d/mysqld restart
4)登入mysql ,直接回车进入mysql /usr/local/mysql/bin/mysql -uroot -p
5)更改密码;
mysql> use mysql;
mysql>update mysql.user SET password=PASSWORD("新密码") where user='root';
6)最后删除掉skip-grant,在重启mysql服务就可用新密码登录。
相关文章推荐
- MySQL中的integer 数据类型
- Linux socket 初步
- MySQL存储过程
- Linux Kernel 4.0 RC5 发布!
- linux lsof详解
- linux 文件权限
- Linux 执行数学运算
- 10 篇对初学者和专家都有用的 Linux 命令教程
- Linux 与 Windows 对UNICODE 的处理方式
- Ubuntu12.04下QQ完美走起啊!走起啊!有木有啊!
- 解決Linux下Android开发真机调试设备不被识别问题
- 运维入门
- 运维提升
- Linux 自检和 SystemTap
- mysql中int、bigint、smallint 和 tinyint的区别与长度
- mysql load data 导出、导入 csv
- source命令执行SQL脚本文件