tett tett - 3 days ago 8
MySQL Question

How to give superuser privileges to MySQL?

I have a MySQL database which is hosted in Azure, and I'm accessing it through MySQL Workbench in my laptop. The point is that when I want to execute some commands I get error message saying I don't have enough privileges. I tried to access the Users and Privileges section in MySQL Workbench, but I got the message saying:


The account you are currently using does not have sufficient
privileges to make changes to MySQL users and privileges.


Where can I give superuser privileges, so that I can execute every command from my MySQL Workbench?

Answer
  1. The privileges is only related to the user, the client you use has nothing to do with it, so whether you use a workbench or a CLI, it does not matter.

  2. In MySQL privileges are arranged to different "user", and "user" are composed by "username" and "host" (from where you login the mysql), so basically, a user in mysql who own specific privilege looks like:

    'foo'@'192.16.22.231', 'bar'@'10.3.243.%' ..
    
  3. How to improve all the privileges to a specific user? do this as a super user:

    GRANT ALL PRIVILEGES ON \*.* TO YOUR_USER
    

    super user is usually 'root'@'127.0.0.1', since you have to grant to your specific 'user', you have to know the IP address from which you login

If you think above is a little complicated and your mysql is just fast-installed and simple configured, you can just try this and maybe it helps:

  1. login as 'root' or mysql
  2. execute this:

    GRANT ALL PRIVILEGES ON \*.* TO 'your_user'@'%';
    
Comments