
- 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
What are the minimum MySQL user privileges to allow optimize and repair?
The select and insert statements are the minimum required MySQL user privileges to allow optimize and repair.
You can use below syntax to give insert and select privileges to the user −
grant insert,select on yourDatabaseName.* to 'yourUserName'@'localhost';
At first, here is the query to create a user −
mysql> create user 'Emma'@'localhost' identified by 'Emma123'; Query OK, 0 rows affected (0.26 sec)
Here is the query to give grants for the above user −
mysql> grant insert,select on web.* to 'Emma'@'localhost'; Query OK, 0 rows affected (0.21 sec)
Here is the query to display all grants of the above user −
mysql> show grants for 'Emma'@'localhost';
This will produce the following output −
+-------------------------------------------------------+ | Grants for Emma@localhost | +-------------------------------------------------------+ | GRANT USAGE ON *.* TO `Emma`@`localhost` | | GRANT SELECT, INSERT ON `web`.* TO `Emma`@`localhost` | +-------------------------------------------------------+ 2 rows in set (0.00 sec)
- Related Articles
- How to create MySQL user with limited privileges?
- How can we grant privileges to a MySQL user?
- Grant all privileges of a database to a MySQL user?
- How can I restore the MySQL root user full privileges?
- How can we revoke privileges from a MySQL user?
- Check privileges (grants) for a specific user in MySQL?
- MySQL new user access denied even after giving privileges?
- How to allow a MySQL user account to connect from any host?
- What are the privileges required to use triggers?
- Which tables are used to control the privileges of MySQL database server?
- What are the properties of MySQL user variables?
- How to check privileges in MySQL?
- Oracle DataBase – Grant Privileges to a User in SQL Command Line
- How to repair MySQL tables from the command line?
- What is the use of FLUSH PRIVILEGES statement in MySQL?

Advertisements