- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Grant all privileges of a database to a MySQL user?
152 Lectures 16 hours
87 Lectures 5.5 hours
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)
- How can we grant privileges to a MySQL user?
- Grant a user permission to only view a MySQL view?
- How can we grant a user to access all stored procedures in MySQL?
- 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?
- Display all grants of a specific user in MySQL
- How can we set up a MySQL User account by using SQL GRANT statement?