ERROR 1044 (42000): Access denied for user ” @ ‘localhost’ to datab…

I know this question is asked many times, and I read al lot of questions going about this, but I think mine is different.

I use a Mac with version 10.10.3 and a Terminal to do my commands.

I am trying to create a local database (and I did it before), but for some reason the access is constantly denied.

This is how my terminal looks like:

iMac-van:mysql 639$ /usr/local/mysql/bin/mysql -v
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 2
Server version: 5.6.24 MySQL Community Server (GPL)

Copyright (c) 2000, 2015, 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.

Reading history-file /Users/639/.mysql_history
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

mysql> quit;
Writing history-file /Users/639/.mysql_history
Bye
iMac-van:mysql 639$ /usr/local/mysql/bin/mysql -u root
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 3
Server version: 5.6.24 MySQL Community Server (GPL)

Copyright (c) 2000, 2015, 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> create database wordpress_db;
ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'wordpress_db'

As you can see I can login to mysql, but I have no permission to create a database.

I tried to login like:

$ /usr/local/mysql/bin/mysql -u root

And:

$ /usr/local/mysql/bin/mysql -u root -p

I have no password, but I can enter mysql without one, but then I cannot create a database.

Select current_user(); returns this:

mysql> select current_user();
+----------------+
| current_user() |
+----------------+
| @localhost     |
+----------------+
1 row in set (0,00 sec)

try to start mysql with –skip-grant-tables

mysqld --skip-grant-tables

then connect to your mysqld without username/password using mysql command line

shell> mysql

then issue command

> mysql> UPDATE mysql.user SET Password=PASSWORD('MyNewPass')
>        WHERE User='root'; mysql> FLUSH PRIVILEGES;
Hello, buddy!责编内容来自:Hello, buddy! (源链) | 更多关于

阅读提示:酷辣虫无法对本内容的真实性提供任何保证,请自行验证并承担相关的风险与后果!
本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » 后端存储 » ERROR 1044 (42000): Access denied for user ” @ ‘localhost’ to datab…

喜欢 (0)or分享给?

专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录