How to grant all privileges to a user in MySql

前端 未结 2 623
庸人自扰
庸人自扰 2021-01-25 17:31

I am connected as a root user in MySql. Root user has GRANT and

grant all privileges on *.* to \'root\'@\'localhost\' with grant option;

went

相关标签:
2条回答
  • 2021-01-25 18:18

    I had the same problem when setting up a new mysql database, at the point of adding the first user.

    I have found my problem was resolved by removing the @'localhost' from the GRANT.

    This works:

    mysql> grant all privileges on . to 'laravel_user'; Query OK, 0 rows affected (0.10 sec)

    This does not:

    mysql> grant all privileges on . to 'laravel_user'@'localhost'; ERROR 1410 (42000): You are not allowed to create a user with GRANT

    ~~~

    mysql version: $ mysql -V mysql Ver 8.0.12 for osx10.14 on x86_64 (Homebrew)

    I was following this guide to set up the database: https://www.a2hosting.co.uk/kb/developer-corner/mysql/managing-mysql-databases-and-users-from-the-command-line

    0 讨论(0)
  • 2021-01-25 18:20

    test this code.

    GRANT ALL PRIVILEGES ON *.* TO 'user'@'localhost' REQUIRE NONE WITH GRANT OPTION MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0;
    
    0 讨论(0)
提交回复
热议问题