root@centos64 mysql]# /usr/bin/mysqld_safe --skip-grant-tables&
2. 再启一个终端:
[root@centos64 proc]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.13 MySQL Community Server (GPL)
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> UPDATE user SET password=password('admin') WHERE user='root';
ERROR 1046 (3D000): No database selected
mysql> show databases ;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.06 sec)
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('admin') WHERE user='root';
Query OK, 4 rows affected (0.04 sec)
Rows matched: 4 Changed: 4 Warnings: 0
mysql> flush privileges; 也可以不用。
mysql> exit
Bye
注意,就是有可能,user表中根本就没有root这个用户。
如果没有此用户,用:
mysql> insert into mysql.user(Host,User,Password,ssl_cipher,x509_issuer,x509_subject) values("localhost","root",password("admin"),"","","");
Query OK, 1 row affected (0.10 sec)
2.授权。 给所有的权限
mysql> grant all privileges on *.* to 'root'@'localhost' identified by 'admin' ;
Query OK, 0 rows affected (0.06 sec)
mysql> flush privileges;
再以正常的方式启动即可。
相关推荐
忘记mysql的root密码怎么办?
windows下忘记mysql的root用户密码详细解决方法
ubuntu 11.10 mysql忘记root密码解决
在上篇文章给大家介绍了Mysql5.7忘记root密码及mysql5.7修改root密码的方法 Mysql5.7忘记密码快速且简单的解决方法,具体方法详情如下所示: # 最简单最粗暴的方法 找到mysql的配置文件直接编辑 vim /etc/my.cnf #...
mysql忘记root密码,重置密码
使用mysql5.5,突然root密码忘记,怎么也登录不了,很急人,该怎么解决呢?下面通过本文给大家介绍mysql5.5忘记root密码的解决办法,需要的朋友参考下吧
新装MySQL不知道密码,忘记MySQL密码,都可以安装该方法改过来,在Ubuntu和CentOS上用过多次。
在实际工作中,忘记了mysql的ROOT 密码,可就糟糕了,本教程分步骤教会你如何重置ROOT密码,绝对能用!放心下载,一看就会!!
忘记mysql中root密码和zabbix登陆密码[整理].pdf
MySQL有时候忘记了root密码是一件伤感的事,这种情况下,如何重置root的密码呢? 找到并编辑mysql的my.ini配置文件,在mysqld节点中添加上skip-grant-table. 如下: # These let you safely reset the lost root ...
再打开一个新的cmd,无密码登录MySQL,输入登录命令:mysql -u root -p 密码置为空,命令如下: use mysql update user set authentication_string='' where user='root'; quit 关闭以-console –skip-grant-...
本文介绍了MySQL修改root密码的多种方法,忘记密码时,管理员可以在服务器上修改ROOT密码,防止忘记密码导致数据无法导出或使用工具连接数据库。
mysql8.0及以上版本,root密码忘记解决方案,自己总结,亲自测试。
如果你忘记了mysqlroot密码 这个文档可以帮助你找回密码
windows7下MySQL5.6忘记root密码方法,仅供参考
MySQL有时候忘记了root密码是一件伤感的事。这里提供Windows 和 Linux 下的密码重置方法。 Windows: 1.以系统管理员身份登陆系统。 2.打开cmd—–net start 查看mysql是否启动。启动的话就停止net stop mysql. 3.我...
MySQL忘记root密码解决方案.docx
mysql忘记超级管理员root密码之后,需要重置密码时请看过来,在文件中可以比较清晰的明白修改的过程,注:这是windows操作系统下的mysql root重置密码的过程
MySQL5.7忘记root密码或者root密码错误