mysql在本地无法使用密码登陆
2014-12-15 00:00
260 查看
摘要: mysql为新用户添加了权限,但仍然提示Access denied
为自己添加了访问数据库权限:
结果提示访问失败:
但可以无密码的方式可以登陆
解决方法参考stackoverflow
说明:
查一下无密码登陆的当前账号:
用无密码的方式登陆localhost,实际上使用的是匿名用户,可以用root密码看一下,当前允许使用匿名用户:
解决方法是删除这个匿名用户:
为自己添加了访问数据库权限:
<!-- lang: shell --> mysql> CREATE USER 'caohong'@'%' IDENTIFIED BY '123456'; mysql> GRANT ALL PRIVILEGES ON testdb.* to 'caohong'@'%' WITH GRANT OPTION;
结果提示访问失败:
<!-- lang: shell --> mysql -u caohong -p Password: ERROR 1045 (28000): Access denied for user 'caohong'@'localhost' (using password: YES)
但可以无密码的方式可以登陆
mysql -u caohong
解决方法参考stackoverflow
说明:
查一下无密码登陆的当前账号:
<!-- lang: shell --> mysql> select user(), current_user(); +-------------------+----------------+ | user() | current_user() | +-------------------+----------------+ | caohong@localhost | @localhost | +-------------------+----------------+ 1 row in set (0.08 sec)
用无密码的方式登陆localhost,实际上使用的是匿名用户,可以用root密码看一下,当前允许使用匿名用户:
<!-- lang: shell --> mysql --user=root mysql mysql> select user, host from mysql.user; +---------+-----------+ | user | host | +---------+-----------+ | caohong | % | | test | % | | root | 127.0.0.1 | | root | ::1 | | | localhost | | root | localhost | | test | localhost | +---------+-----------+
解决方法是删除这个匿名用户:
mysql> drop user ''@'localhost'; Query OK, 0 rows affected (0.09 sec)
相关文章推荐
- 系统无法让你登陆,请你确定你的用户名及域无误,然后再次输入密码.密码字母必须使用正确的大小写.
- 本地用户root无法更改mysql密码与忘记本地root的登录密码解决办法
- 无法使用虚拟目录密码作为用户 XXX 在本地登录到
- Mysql 本地登陆和密码登陆
- MySQL密码正确却无法本地登录的解决方法
- mysql 因忘记密码无法登陆的办法 1045错误
- 解决windows下的mysql匿名登陆无法使用mysql数据库的问题
- MySQl使用-------如何修改root密码&&解决本地无法登录问题
- Red Hat Enterprise Linux AS release 4 下SSH无法使用无密码登陆的原因分析
- mysql 修改密码忘记使用password函数导致后面无法连接,解决方法记录
- Ubuntu中初步安装好MYSQL后,无法登陆问题及mysql添加、删除账号和修改密码操作
- VsFTP本地用户名和密码无法登陆
- HTTP 错误 500.19 - 无法使用虚拟目录密码作为用户 administrator 在本地登录到
- 无法使用虚拟目录密码作为用户在本地登录到网站
- mysql修改密码后无法登陆问题,发生#1251错误
- 解决:“开机设置了密码,可开机时却没有提示要输入密码的提示框,还是直接进入系统”和“系统无法让您登陆.请确定您的用户名及域名无误,然后再输入密码.密码的字母必须使用正确的大小写”
- mysql忘记密码及无法使用程序连接
- 解决phpmyadmin空密码无法登陆mysql
- 解决windows下的mysql匿名登陆无法使用mysql数据库的问题
- HTTP 错误 500.19 - 无法使用虚拟目录密码作为用户 administrator 在本地登录到