Error 1044 <42000>: Access denied for user ''@' localhost' to database

我们两清 提交于 2020-01-11 11:41:29

问题


I started learning PHP since last few days and this is where I'm stuck at.

When I try to type CREATE DATABASE blog; in shell, this is the error I get

'Error 1044 <42000>: Access denied for user ''@' localhost' to database'

How do I fix this?

I found titles to this error but those answer were complicated for me to understand.


回答1:


Entering mysql without a special user is not working. Or better to say: You enter the database, but the user you use then, has nearly no rights/priviliges. So in the beginning you need to login with your root account with mysql -u root -p. Then you can create your databases and work with them.

Hint 1: Never work with the root user in a productive system, but create an user, that just has access to one database.
Hint 2: Change the password of the root user as soon as possible with UPDATE user SET Password=PASSWORD('mein_pwd') WHERE user='root'; when you're in the database.



来源:https://stackoverflow.com/questions/24693440/error-1044-42000-access-denied-for-user-localhost-to-database

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!