zoukankan      html  css  js  c++  java
  • ERROR 1045 (28000): Access denied for user 'mysql'@'localhost' (using password: YES

    解决方法:

    利用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 |
    +--------------------+

    4 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 '1';#  %代表所有端口
    Query OK, 0 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        |
    +-----------+------------------+
    5 rows in set (0.00 sec)

    查看数据库列表:

    mysql> show databases;
    +--------------------+
    | Database           |
    +--------------------+
    | information_schema |
    +--------------------+
    1 row in set (0.00 sec)
    
    mysql>
  • 相关阅读:
    win7 重装 docker 启动后无法启动错误解决
    ASP.NET MVC 播放远程服务器上的MP3文件
    ubuntu+mono+PetaPoco+Oracle+.net 程序部署
    .NET Core 2.0 问题杂记
    博客园挂了吗?
    Content-Type: application/vnd.ms-excel">
    Storm
    Razor语法
    类型后面加问号 int?
    Apache vue site configuration
  • 原文地址:https://www.cnblogs.com/jiangfeilong/p/10555185.html
Copyright © 2011-2022 走看看