mysql忘记root密码
来源:互联网 发布:matlab 2017b mac 编辑:程序博客网 时间:2024/05/01 23:31
[root@cookie ~]# find / -name 'my.cnf' //查找my.cnf文件位置
/etc/my.cnf
[root@cookie ~]# vim /etc/my.cnf //编辑my.cnf文件
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
old_passwords = 1
default-character-set = utf8
skip-grant-tables //添加skip-grant-tables
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[root@cookie ~]# /etc/init.d/mysqld restart //mysql重启
Stopping mysqld: [ OK ]
Starting mysqld: [ OK ]
[root@cookie ~]# mysql -p //直接登录,无需密码
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.73 Source distribution
Copyright (c) 2000, 2013, 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>
mysql>
mysql> update mysql.user set password=password('v1GLrOSgdmus5yTLM9guI8CecqG2') where user='root';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3 Changed: 3 Warnings: 0
mysql>
mysql>
mysql> exit
Bye
[root@cookie ~]#
[root@cookie ~]# vim /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
old_passwords = 1
default-character-set = utf8
#skip-grant-tables //注释掉skip-grant-tables
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[root@cookie ~]# /etc/init.d/mysqld restart
Stopping mysqld: [ OK ]
Starting mysqld: [ OK ]
[root@cookie ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.1.73 Source distribution
Copyright (c) 2000, 2013, 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>
mysql>
- MySQL忘记root密码
- MYSQL忘记root密码
- mysql root 密码忘记????
- mysql忘记root密码
- mysql root 密码忘记
- mysql 忘记root密码
- mysql忘记root密码
- mysql忘记root密码
- mysql root忘记密码
- mysql忘记root密码
- mysql root忘记密码
- MySQL忘记root密码
- mysql root 密码忘记
- mysql root 密码忘记
- MYSQL忘记root密码
- 忘记mysql root密码
- mysql root忘记密码
- mysql root 密码忘记
- Android 通过Java代码动态获取控件位置的终极解决之道
- Python-数据库游标对象详解
- 2016.8.28 随写
- 越过Android中布局文件中使用onClick属性的坑
- 2016.8.29 解题报告之我会做的题都是简单题
- mysql忘记root密码
- 2016.8.29 LGTB解题报告
- 手机页面的切换
- 第十周项目2-二叉树遍历的递归算法
- 2016.9.3 好好学习天天快乐解题报告
- 【BZOJ】3992 [SDOI2015]序列统计 【离散对数下的NTT】
- 维护篇(5.2)-08. 批量命令操作 ❀ 飞塔 (Fortinet) 防火墙
- 《将博客搬至CSDN》
- 动态include与静态include的区别