解决方法:

利用mysql安装时的默认用户名登录mysql后, 输入以下命令修改root密码

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass'; 

2. 授予用户权限

GRANT ALL PRIVILEGES ON *.* TO 'jiang'@'%' IDENTIFIED BY '1';
flush privileges;

下面的内容没有用到

一.有时可以直接输入命令: mysql进入数据库

启动数据库:# mysqld_safe &

二.查看用户命令:

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> select host,user from mysql.user;//show databases;

+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+

 rows in set (0.00 sec)

mysql> 

 删除用户

  

mysql>Delete FROM user Where User='test' and Host='localhost';

   mysql>flush privileges;

   mysql>drop database testDB; //删除用户的数据库

删除账户及权限:>drop user 用户名@'%';

        >drop user 用户名@ localhost;

创建用户

mysql> create user 'root'@'%' identified by '';#  %代表所有端口
Query OK, rows affected (0.07 sec) mysql> select host,user from mysql.user;
+-----------+------------------+
| host | user |
+-----------+------------------+
| % | root |
| % | usrabc |
| localhost | mysql.infoschema |
| localhost | mysql.session |
| localhost | mysql.sys |
+-----------+------------------+
rows in set (0.00 sec)

查看数据库列表:

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
+--------------------+
row in set (0.00 sec) mysql>

ERROR 1045 (28000): Access denied for user 'mysql'@'localhost' (using password: YES的更多相关文章

  1. Linux mysql 5.6: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

    案例环境: 操作系统 :Red Hat Enterprise Linux Server release 5.7 (Tikanga) 64 bit 数据库版本 : Mysql 5.6.19 64 bit ...

  2. MySQL ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)的真正原因

    在博客Linux mysql 5.6: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: N ...

  3. mysql 链接失败(ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES))

    mysql链接失败(ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)) 修改: # ...

  4. 安装mysql因为/tmp权限不足而导致ERROR 1045 (28000): Access denied for user root@localhost (using password: NO)的解决方案

    本机是centos 6.5  安装的mysql是5.1的版本. 在安装mysql之后,第一次启动mysql服务的时候,需要/tmp有777(rwxrwxrwx)的权限,然而楼主的/tmp是755(rw ...

  5. MySQL学习笔记——ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

    ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) Enter password: E ...

  6. Mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost'(using password: YSE)

    安装mysql后,使用命令登录mysql居然报错了,Mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost'(using ...

  7. MySQL ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO

    MySQL安装完server端和客户端后,登录Mysql时报错:[root@rhel204 MySQL 5.6.23-RMP]# mysqlERROR 2002 (HY000): Can't conn ...

  8. [mysql] ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES).

    用mysql -u root -p显示ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YE ...

  9. mysql全局权限账户%登录不上ERROR 1045 (28000): Access denied for user 'mhz'@'localhost' (using password: YES)

    mysql全局权限账户%登录不上ERROR 1045 (28000): Access denied for user 'mhz'@'localhost' (using password: YES) 解 ...

随机推荐

  1. 转: hibernate配置文件hibernate.cfg.xml和.hbm.xml的详细解释

    http://blog.csdn.net/yuhui123999/article/details/51886531 hibernate.cfg.xml -标准的XML文件的起始行,version='1 ...

  2. MySql cmd下的学习笔记 —— 有关子查询的操作(where型,from型,exists型子查询)

    先找到goods表 查询goods_id最大的商品 where型的子查询 查询goods_id最大的商品(不能用排序) 把两步写成一步,就是子查询 from型子查询 查找出每种cat_id下goods ...

  3. Python学习笔记-解释器和中文编码

    第一行 #!/usr/bin/env python 目的是指出用什么可执行程序去运行代码. 有两种写法 1.#!/usr/bin/python 调用/usr/bin下的python解释器,去运行代码. ...

  4. Shell基础总结

    一.用户登陆进入系统后的系统环境变量 $HOME 使用者自己的目录 $PATH 执行命令时所搜寻的目录 $TZ 时区 $MAILCHECK 每隔多少秒检查是否有新的信件 $PS1 在命令列时的提示号 ...

  5. Git学习笔记05-撤销修改

    使用 git checkout -- file可以撤销工作区的修改 一种是修改后还没有放到暂存区,撤销修改回到和版本库一模一样的状态 lesson.txt文件已经提交到版本库了,内容如图. ​ 修改一 ...

  6. python多线程并发

    # coding=utf8 # 使用前需安装net-snmp-utils或net-snmp包 from _utils.patrol2 import run_cmd import sys import ...

  7. unity优化建议

    使用Profiler工具分析内存占用情况 System.ExecutableAndDlls:系统可执行程序和DLL,是只读的内存,用来执行所有的脚本和DLL引用.不同平台和不同硬件得到的值会不一样,可 ...

  8. wtforms-表单生成及验证

    介绍 wtforms是一个支持多个web框架的form组件,主要用来做表单的验证以及生成的, 安装 pip install wtforms 使用 自定义一个类,继承wtforms.Form类,定义字段 ...

  9. ubuntu14.04上引入thinkphp5类库遇到的一个问题

    ubuntu14.04 上加载OSS\OssClient() ;--->在vendor文件夹下的文件要用大写OSS 小写的报错 无法加载类库 Vendor('OSS.autoload');//引 ...

  10. latex公式、编号、对齐

    原文地址:http://blog.csdn.net/hjq376247328/article/details/49718931 LaTeX的数学公式有两种,即行中公式和独立公式.行中公式放在正文中间, ...