简体   繁体   中英

ERROR 1044 (42000): Access denied for user 'root'@'localhost' to database 'newdb'

now, I can login the mysql with mysql -uroot -p , then I input my password.

Then I try to do this.

mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | +--------------------+

But when I create database, i get an error:

mysql> CREATE DATABASE newdb; ERROR 1044 (42000): Access denied for user 'root'@'localhost' to database 'newdb'

this is my grants:

mysql> show grants; +------------------------------------------+ | Grants for root@localhost | +------------------------------------------+ | GRANT USAGE ON *.* TO 'root'@'localhost' | +------------------------------------------+

on the terminal with MacOSX. Thanks for any help.

From the docs , GRANT USAGE is a:

Synonym for “no privileges”

Leaving aside the point that this privilege has a confusing name, I'm not sure how/why you have such limited privileges for root, anyway.

What you want for root is GRANT ALL . Even better, leave root as-is and create a different superuser with local-only access to replace root. But do note that, in general, you want to give users only the bare minimum privileges necessary for whatever they need to do.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM