mysql增加新用户无法登陆解决方法 ERROR 1045 (28000): Access denied for user 'appadmin'@'localhost' (using password: YES)
解决方法:
增加普通用户后,执行:
mysql> use mysql
mysql> delete from user where user='';
mysql> flush privileges;
意思是删除匿名用户。
以root连接到服务器上后,可以添加新账户。下面的语句使用GRANT来设置四个新账户:
123456
mysql> GRANT ALL PRIVILEGES ON *.* TO
'monty'
@
'localhost'
-> IDENTIFIED BY
'some_pass'
WITH GRANT OPTION;
mysql> GRANT ALL PRIVILEGES ON *.* TO
'monty'
@
'%'
-> IDENTIFIED BY
'some_pass'
WITH GRANT OPTION;
mysql> GRANT RELOAD,PROCESS ON *.* TO
'admin'
@
'localhost'
;
mysql> GRANT USAGE ON *.* TO
'dummy'
@
'localhost'
;
用GRANT语句创建的账户有下面的属性:
· 其中两个账户有相同的用户名monty和密码some_pass。两个账户均为超级用户账户,具有完全的权限可以做任何事情。一个账户 ('monty'@'localhost')只用于从本机连接时。另一个账户('monty'@'%')可用于从其它主机连接。请注意monty的两个账户必须能从任何主机以monty连接。没有localhost账户,当monty从本机连接时,mysql_install_db创建的localhost的匿名用户账户将占先。结果是,monty将被视为匿名用户。原因是匿名用户账户的Host列值比'monty'@'%'账户更具体,这样在user
mysql增加新用户无法登陆解决方法 ERROR 1045 (28000): Access denied for user 'appadmin'@'localhost' (using password: YES)
mysql> GRANT ALL PRIVILEGES ON *.* TO
'monty'
@
'localhost'
-> IDENTIFIED BY
'some_pass'
WITH GRANT OPTION;
mysql> GRANT ALL PRIVILEGES ON *.* TO
'monty'
@
'%'
-> IDENTIFIED BY
'some_pass'
WITH GRANT OPTION;
mysql> GRANT RELOAD,PROCESS ON *.* TO
'admin'
@
'localhost'
;
mysql> GRANT USAGE ON *.* TO
'dummy'
@
'localhost'
;
解决方法:
增加普通用户后,执行:
mysql> use mysql
mysql> delete from user where user='';
mysql> flush privileges;
意思是删除匿名用户。
以root连接到服务器上后,可以添加新账户。下面的语句使用GRANT来设置四个新账户:
123456 | mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty' @ 'localhost' -> IDENTIFIED BY 'some_pass' WITH GRANT OPTION; mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty' @ '%' -> IDENTIFIED BY 'some_pass' WITH GRANT OPTION; mysql> GRANT RELOAD,PROCESS ON *.* TO 'admin' @ 'localhost' ; mysql> GRANT USAGE ON *.* TO 'dummy' @ 'localhost' ; |
用GRANT语句创建的账户有下面的属性:
· 其中两个账户有相同的用户名monty和密码some_pass。两个账户均为超级用户账户,具有完全的权限可以做任何事情。一个账户 ('monty'@'localhost')只用于从本机连接时。另一个账户('monty'@'%')可用于从其它主机连接。请注意monty的两个账户必须能从任何主机以monty连接。没有localhost账户,当monty从本机连接时,mysql_install_db创建的localhost的匿名用户账户将占先。结果是,monty将被视为匿名用户。原因是匿名用户账户的Host列值比'monty'@'%'账户更具体,这样在user