Grant **all** privileges on database

grant all privileges on database postgres
error 1410 (42000): you are not allowed to create a user with grant
mysql> grant all privileges to 'root
grant all privileges oracle
grant all privileges mariadb
mysql grant all privileges identified by 'password
mysql grant all privileges to user from any host
grant all privileges mysql 8

I've created database, for example 'mydb'.

CREATE DATABASE mydb CHARACTER SET utf8 COLLATE utf8_bin;
CREATE USER 'myuser'@'%' IDENTIFIED BY PASSWORD '*HASH';
GRANT ALL ON mydb.* TO 'myuser'@'%';
GRANT ALL ON mydb TO 'myuser'@'%';
GRANT CREATE ON mydb TO 'myuser'@'%';
FLUSH PRIVILEGES;

Now i can login to database from everywhere, but can't create tables.

How to grant all privileges on that database and (in the future) tables. I can't create tables in 'mydb' database. I always get:

CREATE TABLE t (c CHAR(20) CHARACTER SET utf8 COLLATE utf8_bin);
ERROR 1142 (42000): CREATE command denied to user 'myuser'@'...' for table 't'

GRANT ALL PRIVILEGES ON mydb.* TO 'myuser'@'%' WITH GRANT OPTION;

This is how I create my "Super User" privileges (although I would normally specify a host).

IMPORTANT NOTE

While this answer can solve the problem of access, WITH GRANT OPTION creates a MySQL user that can edit the permissions of other users.

The GRANT OPTION privilege enables you to give to other users or remove from other users those privileges that you yourself possess.

For security reasons, you should not use this type of user account for any process that the public will have access to (i.e. a website). It is recommended that you create a user with only database privileges for that kind of use.

Grant **all** privileges on database, GRANT SELECT, INSERT ON *.* TO u1;. The globally granted privileges apply to all databases, tables, and  Second, use the GRANT ALL PRIVILEGES statement to grant all privileges to the super user: GRANT ALL PRIVILEGES TO super; Third, log in to the Oracle Database as the super user: Enter user-name: super@pdborcl Enter password: And query the super user’s privileges: SELECT * FROM session_privs ORDER BY privilege; Here is the output in Oracle 12c:


This is old question but I don't think the accepted answer is safe. It's good for creating a super user but not good if you want to grant privileges on a single database.

grant all privileges on mydb.* to myuser@'%' identified by 'mypasswd';
grant all privileges on mydb.* to myuser@localhost identified by 'mypasswd';

% seems to not cover socket communications, that the localhost is for. WITH GRANT OPTION is only good for the super user, otherwise it is usually a security risk.

Update for MySQL 5.7+ seems like this warns about:

Using GRANT statement to modify existing user's properties other than privileges is deprecated and will be removed in future release. Use ALTER USER statement for this operation.

So setting password should be with separate commands. Thanks to comment from @scary-wombat.

ALTER USER 'myuser'@'%' IDENTIFIED BY 'mypassword';
ALTER USER 'myuser'@'localhost' IDENTIFIED BY 'mypassword';

Hope this helps.

MySQL 5.7 Reference Manual :: 13.7.1.4 GRANT Statement, GRANT SELECT, INSERT ON *.* TO u1;. The globally granted privileges apply to all databases, tables, and  This tutorial explains how you can grant privileges on a database in MySQL. It will introduce you all the steps beginning from connecting to MySQL and then accessing the MySQL commands to set the desired level of privileges. So, if you wish to grant or update the privileges in MySQL, first you should connect to the running MySQL instance.


This will be helpful for some people:

From MySQL command line:

CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';

Sadly, at this point newuser has no permissions to do anything with the databases. In fact, if newuser even tries to login (with the password, password), they will not be able to reach the MySQL shell.

Therefore, the first thing to do is to provide the user with access to the information they will need.

GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost';

The asterisks in this command refer to the database and table (respectively) that they can access—this specific command allows to the user to read, edit, execute and perform all tasks across all the databases and tables.

Once you have finalized the permissions that you want to set up for your new users, always be sure to reload all the privileges.

FLUSH PRIVILEGES;

Your changes will now be in effect.

For more information: http://dev.mysql.com/doc/refman/5.6/en/grant.html

If you are not comfortable with the command line then you can use a client like MySQL workbench, Navicat or SQLyog

MySQL 8.0 Reference Manual :: 13.7.1.6 GRANT Statement, The answers to your questions come from the online PostgreSQL 8.4 docs. GRANT ALL PRIVILEGES ON DATABASE grants the CREATE  GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost'; The asterisks in this command refer to the database and table (respectively) that they can access—this specific command allows to the user to read, edit, execute and perform all tasks across all the databases and tables.


 1. Create the database

CREATE DATABASE db_name;

 2. Create the username for the database db_name

GRANT ALL PRIVILEGES ON db_name.* TO 'username'@'localhost' IDENTIFIED BY 'password';

 3. Use the database

USE db_name;

 4. Finally you are in database db_name and then execute the commands like create , select and insert operations.

Postgresql: what does GRANT ALL PRIVILEGES ON DATABASE do , Grant ** all ** database permissions. I created a database, such as'mydb'. CREATE DATABASE mydb CHARACTER SET utf8 COLLATE  The newly created user does not have privileges to manage databases nor to access the MariaDB shell. To grant all privileges to user1: GRANT ALL PRIVILEGES ON *.* TO 'user1'@localhost IDENTIFIED BY 'password1'; The *.* in the statement refers to the database or table for which the user is given privileges. This specific command provides access to all databases located on the server.


This SQL grants on all databases but just basic privileges. They're enough for Drupal or Wordpress and as a nicety, allows one developer account for local projects.

GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, 
    INDEX, ALTER, CREATE TEMPORARY TABLES 
ON *.* TO 'username'@'localhost' IDENTIFIED BY 'password';

Grant ** all ** database permissions, The GRANT OPTION privilege allows a user to pass on any privileges she has to other users. Consider mysql> GRANT ALL ON music. hugh can pass on his privileges on that database, or on any of the tables or columns in that database. The MANAGE GRANTS global privilege is required to grant or revoke privileges on future objects at the database level. By default, only the SECURITYADMIN and ACCOUNTADMIN roles have the MANAGE GRANTS privilege. For more information about future grants, see Future Grants on Database or Schema Objects in this topic.


The GRANT OPTION Privilege, This variant of the GRANT command gives specific privileges on a database object The key word PUBLIC indicates that the privileges are to be granted to all  For the global, database, table, and routine levels, GRANT ALL assigns only the privileges that exist at the level you are granting. For example, GRANT ALL ON db_name .* is a database-level statement, so it does not grant any global-only privileges such as FILE .


Create new MySQL user for your Database and Grant all privileges , mariadb MySQL: Grant **all** privileges on database? GRANT SELECT, INSERT​, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY  The ALL PRIVILEGES privilege grants all available privileges. Granting all privileges only affects the given privilege level. For example, granting all privileges on a table does not grant any privileges on the database or globally. Using ALL PRIVILEGES does not grant the special GRANT OPTION privilege.


Documentation: 8.1: GRANT, ALL PRIVILEGES – Grants all privileges to a user account. CREATE – The user account is allowed to create databases and tables. DROP - The user account is allowed to drop databases and tables. DELETE - The user account is allowed to delete rows from a specific table.