
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
Grant all privileges of a database to a MySQL user?
First, create a user and password using CREATE command. The syntax is as follows.
CREATE USER 'yourUserName'@'localhost' IDENTIFIED BY 'yourPassword';
The syntax to give all privileges of the specific database to the user is as follows.
GRANT ALL PRIVILEGES ON yourDatabaseName . * TO 'yourUserName'@'localhost';
Now you can implement the above syntaxes to create a user and grant all privileges. The query is as follows to create a user.
mysql> create user 'Adam Smith'@'localhost' IDENTIFIED BY 'Adam123456'; Query OK, 0 rows affected (0.29 sec)
Now, grant all privileges to the user. The query is as follows.
mysql> GRANT ALL PRIVILEGES ON test . * TO 'Adam Smith'@'localhost'; Query OK, 0 rows affected (0.19 sec)
- Related Articles
- How can we grant privileges to a MySQL user?
- Oracle DataBase – Grant Privileges to a User in SQL Command Line
- How can we grant a user to access all stored procedures in MySQL?
- Grant a user permission to only view a MySQL view?
- How to display grant defined for a MySQL user?
- How to grant replication privilege to a database in MySQL?
- How can we revoke privileges from a MySQL user?
- Check privileges (grants) for a specific user in MySQL?
- MySQL query to create user and grant permission
- How to create MySQL user with limited privileges?
- How to add super privileges to MySQL database?
- MySQL new user access denied even after giving privileges?
- Which tables are used to control the privileges of MySQL database server?
- How to GRANT SELECT ON all tables in all databases on a server with MySQL?
- How can we set up a MySQL User account by using SQL GRANT statement?

Advertisements