ERROR 1045 (28000): Access denied for user 'hive'@'localhost' (using password: YES)

[[email protected] native]# mysql -uhive -p
Enter password: 
ERROR 1045 (28000): Access denied for user ‘hive‘@‘localhost‘ (using password: YES)
[[email protected] native]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.1.61 Source distribution

Copyright (c) 2000, 2011, 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> 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 user;
+-----------+------+
| host      | user |
+-----------+------+
| %         | Hive |
| %         | root |
| 127.0.0.1 | root |
| localhost |      |
| localhost | root |
| master    |      |
| master    | root |
+-----------+------+
7 rows in set (0.00 sec)

mysql> delete from user where user=‘ ‘;
Query OK, 2 rows affected (0.00 sec)

mysql> commit;
Query OK, 0 rows affected (0.00 sec)

mysql> select host,user from user;
+-----------+------+
| host      | user |
+-----------+------+
| %         | hive |
| %         | root |
| 127.0.0.1 | root |
| localhost | root |
| master    | root |
+-----------+------+
5 rows in set (0.00 sec)

mysql> delete from user where host=‘127.0.0.1‘;
Query OK, 1 row affected (0.00 sec)

mysql> delete from user where host=‘localhost‘;
Query OK, 1 row affected (0.00 sec)

mysql> commit;
Query OK, 0 rows affected (0.00 sec)

mysql> select host,user from user;
+--------+------+
| host   | user |
+--------+------+
| %      | hive |
| %      | root |
| master | root |
+--------+------+
3 rows in set (0.00 sec)

mysql> exit
Bye
[[email protected] native]# mysql -uhive -p
Enter password: 
ERROR 1045 (28000): Access denied for user ‘hive‘@‘localhost‘ (using password: YES)
[[email protected] native]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.1.61 Source distribution

Copyright (c) 2000, 2011, 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> 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> delete from user where user=‘hive‘;
Query OK, 1 row affected (0.00 sec)

mysql> commmit;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘commmit‘ at line 1
mysql> commit;
Query OK, 0 rows affected (0.00 sec)

mysql> select host,user from user;
+--------+------+
| host   | user |
+--------+------+
| %      | root |
| master | root |
+--------+------+
2 rows in set (0.00 sec)

mysql> grant all privileges on hive.* to [email protected]"%" identified by "hive" with grant option;
Query OK, 0 rows affected (0.00 sec)

mysql> select host,user from user;
+--------+------+
| host   | user |
+--------+------+
| %      | hive |
| %      | root |
| master | root |
+--------+------+
3 rows in set (0.00 sec)

mysql> exit
Bye
[[email protected] native]# mysql -uhive -phive
ERROR 1045 (28000): Access denied for user ‘hive‘@‘localhost‘ (using password: YES)
[[email protected] native]# mysql -uhive -phive -h master
ERROR 1045 (28000): Access denied for user ‘hive‘@‘master‘ (using password: YES)
[[email protected] native]# mysql -uhive -h master -p
Enter password: 
ERROR 1045 (28000): Access denied for user ‘hive‘@‘master‘ (using password: YES)
[[email protected] native]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 5.1.61 Source distribution

Copyright (c) 2000, 2011, 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> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| hive               |
| mysql              |
| test               |
+--------------------+
4 rows in set (0.00 sec)

mysql> user hive
    -> ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘user hive‘ at line 1
mysql> show tables;
ERROR 1046 (3D000): No database selected
mysql> use hive;
Database changed
mysql> show tables;
Empty set (0.00 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> grant all privileges on hive.* to [email protected]"master" identified by "hive" with grant option;
Query OK, 0 rows affected (0.00 sec)

mysql> select host,user from user;
+--------+------+
| host   | user |
+--------+------+
| %      | hive |
| %      | root |
| master | hive |
| master | root |
+--------+------+
4 rows in set (0.00 sec)

mysql> exit
Bye
[[email protected] native]# mysql -uhive -h master -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 5.1.61 Source distribution

Copyright (c) 2000, 2011, 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> show database;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘database‘ at line 1
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| hive               |
| test               |
+--------------------+
3 rows in set (0.00 sec)

mysql> exit
Bye
[[email protected] native]# mysql -uhive -p
Enter password: 
ERROR 1045 (28000): Access denied for user ‘hive‘@‘localhost‘ (using password: YES)
[[email protected] native]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 5.1.61 Source distribution

Copyright (c) 2000, 2011, 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> 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> grant all privileges on hive.* to [email protected]"localhost" identified by "hive" with grant option;
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye
[[email protected] native]# mysql -uhive -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 14
Server version: 5.1.61 Source distribution

Copyright (c) 2000, 2011, 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> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| hive               |
| test               |
+--------------------+
3 rows in set (0.00 sec)

mysql> use hive;
Database changed
mysql> show tables;
Empty set (0.00 sec)

mysql>

ERROR 1045 (28000): Access denied for user 'hive'@'localhost' (using password: YES)

时间: 2024-12-29 07:16:43

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

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

在安装好的MySQL服务器上,配置了环境变量之后,发现用mysql无法登录,报如题的错误,实在没有办法,决定用安全模式对root用户修改密码: 首先在一个ssh窗口运行命令:mysqld_safe --user=mysql --skip-grant-tables --skip-networking& [[email protected] ~]# mysqld_safe --user=mysql --skip-grant-tables --skip-networking& 运行之后新打开一个

Mac下解决mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

Maybe updating the package the updater overwrote the root password. To restore it: Stop mysqld deamons. $ sudo service mysqld stop Go to mysql/bin directory $ cd /usr/bin Start a mysql deamon with this option: $ sudo mysqld_safe --skip-grant-tables O

升级到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

MySQL使用错误解决:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

解决方法: ⑴打开mysql中的my.ini(如果没有就将my-default.ini复制一份,并修改为my.ini): ⑵在[mysqld]下面空白行直接添加skip-grant-tables: ⑶重启mysql,在cmd页面输入mysql,按回车键即可. 注:这会使你的mysql无法设置密码,但对个人使用而言这岂不是更省了一步! MySQL使用错误解决:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using p

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

To start mysqld at boot time you have to copysupport-files/mysql.server to the right place for your system PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !To do so, start the server, then issue the following commands: /usr/bin/mysqladmin -

MySQL5.5出面ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)问题的解决办法

问题描述 安装完MySQL5.5数据库,使用Navicat Premium以及命令窗口连接数据库都报以下错误: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) 解决办法 通常该错误是忘记密码导致的,所以我们需要修改密码,具体操作步骤如下: 1.打开D:\Program Files\MySQL\MySQL Server 5.5\my.ini,在[mysqld]下增加一行启动参数

mysql登陆提示ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO

今天安装zabbix,安装完成之后在最上面提示如下所示 检查日志如下显示 显示连接数据库失败,登录mysql给zabbix授权之后发现zabbix彻底起不来了 数据库也登陆不进去,提示ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) 数据库拒绝了root登录,于是先跳过受权表访问,命令如下:mysqld_safe --user=mysql --skip-grant-tables -

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

最近操作mysql 5.6, 出现了以下问题. 分享,感谢原著: 案例环境: 操作系统 :Red Hat Enterprise Linux Server release 5.7 (Tikanga) 64 bit 数据库版本 : Mysql 5.6.19 64 bit 案例介绍: 今 天开始学习mysql,遂先安装了Mysql 5.6.19 64bit 版本的数据库,结果安装成功了,但是使用root登录时遇到了ERROR 1045 (28000): Access denied for user '

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)解决办法

问题重现(以下讨论范围仅限Windows环境): C:\AppServ\MySQL> mysql -u root -pEnter password:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) 编辑mysql配置文件my.ini(不知道在哪请搜索),在[mysqld]这个条目下加入  skip-grant-tables保存退出后重启mysql 1.点击“开始”->“运行”(