- A+
每次在LINUX上安装好MYSQL数据库服务器后,利用Navicat管理时,总是提示下列错误:
navicat远程连接报错1045 access denied for user'root'@'ip'(using pasword:yes)
【解决办法如下】:
在本地或利用SSH登录mysql数据库,输入以下两条命令。
- GRANT ALL PRIVILEGES ON . TO'root'@'%' IDENTIFIED BY '' WITH GRANT OPTION;
- flush privileges;
注:这里*****表示数据库密码,在第二步中也可以通过重启数据库服务来实现。
具体操作如下示例:
- [root@ITCMDB ~]# mysql -u root -p
- Enter password:
- Welcome to the MySQL monitor. Commands end with ; or \g.
- Your MySQL connection id is 233
- Server version: 5.7.22 MySQL Community Server (GPL)
- Copyright (c) 2000, 2018, 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 PRIVILEGES ON *.* TO'root'@'%' IDENTIFIED BY 'ABDd123469#' WITH GRANT OPTION;
- Query OK, 0 rows affected, 1 warning (0.00 sec)
- mysql> flush privileges;
- Query OK, 0 rows affected (0.00 sec)
- mysql>