mysql报错ERROR 1045 (28000)

新安装了一个mysql,创建了一个新的用户dadmin,授予ALL权限

mysql>GRANT ALL ON *.* TO ‘dadmin‘@‘localhost‘ IDENTIFIED BY ‘123456‘;

mysql>DROP USER ‘root‘@‘localhost‘;

mysql>DROP USER ‘root‘@‘localhost.localdomain‘;

mysql>DROP USER ‘root‘@‘::1‘;

mysql>DROP USER ‘root‘@‘127.0.0.1‘;

后面才想起来,忘记给‘dbaadmin‘@‘%‘远程权限,然后开始授权

mysql> GRANT ALL ON *.* TO ‘dadmin‘@‘%‘ IDENTIFIED BY ‘123456‘;

ERROR 1045 (28000): Access denied for user ‘dadmin‘@‘localhost‘ (using password: YES)

出现这个问题,这样解决:

mysql>use mysql

mysql> update user set grant_priv = ‘Y‘ where user = ‘dadmin‘;

Query OK, 1 row affected (0.03 sec)

Rows matched: 1  Changed: 1  Warnings: 0

mysql> commit;

Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;

Query OK, 0 rows affected (0.02 sec)

mysql> quit        //退出,再次连接

Bye

[[email protected] ~]# mysql -udadmin -p

Enter password:

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 171

Server version: 5.6.13-log 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> GRANT ALL ON *.* TO ‘dadmin‘@‘%‘ IDENTIFIED BY ‘123456‘;

Query OK, 0 rows affected (0.03 sec)

mysql> show grants for ‘dbaadmin‘@‘%‘;    //授权成功

+------------------------------------------------------------------------------------------------------------------+

| Grants for [email protected]%                                                                                            |

+------------------------------------------------------------------------------------------------------------------+

| GRANT ALL PRIVILEGES ON *.* TO ‘dbaadmin‘@‘%‘ IDENTIFIED BY PASSWORD ‘*ED09FA20652595D6114A30C5045A520B8A39839C‘ |

+------------------------------------------------------------------------------------------------------------------+

1 row in set (0.00 sec)

时间: 2024-10-10 21:30:09

mysql报错ERROR 1045 (28000)的相关文章

mac安装mysql报错ERROR 1045 (28000): Access denied for.

安装完后,mysql -h localhost -u root -p 时候报错,ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)第一步:删除 /usr/local/mysql/data/ 下的 ib_logfile0和ib_logfile1文件.第二步:在系统偏好设置中停止Mysql服务第三步:cd /usr/local/mysql/bin/执行 ./mysqld_safe --

升级到macOS 10.12 mysqlb报错ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

系统升级到macOS 10.12后启动mysql后,在终端输入mysql 报错ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES/NO) 解决办法1 在系统偏好设置里关闭mySQL2 $ cd /usr/bin3 $ sudo mysqld_safe --skip-grant-tables4 再打开一个终端$ mysqlmysql> use mysql;mysql> UPDATE

CentOS命令登录MySQL时,报错ERROR 1045 (28000):

CentOS命令登录MySQL时,报错ERROR 1045 (28000): Access denied for user [email protected] (using password: NO)错误解决方法 1.停用mysql服务:# /etc/rc.d/init.d/mysqld stop 2.输入命令:# mysqld_safe --user=mysql --skip-grant-tables --skip-networking & 3.登入数据库:# mysql -u root my

mysql登录报错ERROR 1045 (28000的解决方法

问题描述: mysql -u root -p命令登录MySQL,提示ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) 解决办法: information_schema 库的USER_PRIVILEGES 表中 没有给 'root'@'localhost' 赋权. mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' ID

yum安装mysql步骤及报错ERROR 1045 (28000)

1.centos 系统中使用yum工具安装 mysql. [[email protected] ~]#yum install -y mysql 2.yum install -y mysql后,启动mysql报错如下: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) 解决办法:缺少组件,安装mysql-server包. 3.安装组件mysql

mysql登录报错 ERROR 1045 (28000)

1.现象: [[email protected] ~]# mysql -u root -p Enter password: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) 2.原因:数据库中存在空用户所致 3.解决方案: 1)停用mysql服务:# service mysql stop 2)输入命令:# mysqld_safe --user=mysql --skip-grant

Mariadb初始登陆报错 ERROR 1045 (28000) 的解决办法

今天,测试环境下需要使用到mysql数据库;于是我使用yum安装方式快速部署了mariadb.使用的Linux系统版本为CentOS 7.x. 安装完成后,我很自然的使用mysql命令登陆,因为是刚安装的初始环境,结果报错了: [[email protected] ~]# mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) 第一次碰到这种情况.我检查了配置文件,没发现异常

mac mysql连接报错ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

找了半天 又是kill进程,又是改设置文件,又是重启电脑,都不管用 翻到stackoverflow上的解决方案,实施成功: 原文链接:https://stackoverflow.com/questions/13480170/access-denied-for-mysql-error-1045 To restore it: Stop mysqld deamons. $ sudo service mysqld stop Go to mysql/bin directory $ cd /usr/bin

一看便知linux下mysql报错ERROR 1044: Access denied for user: '@localhost' to database 'mysql'

错误信息:ERROR 1044: Access denied for user: '@localhost' to database 'mysql' linux下解决方案: mysql> use mysql ERROR 1044 (42000): Access denied for user 'root'@'localhost' to database 'mysql' mysql> exit Bye [[email protected] ~]# service mysqld stop如果该命令不